Skip to content

Use a nonzero initial size with llvm::SmallSet. #58399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented May 13, 2025

Fixes compilation warnings and a failed assertion, at least when using LLVM 18:

In file included from /home/tim/Julia/src/julia/build/dev/usr/include/llvm/IR/PassManager.h:42,
                 from /home/tim/Julia/src/julia/build/dev/usr/include/llvm/Analysis/TargetTransformInfo.h:27,
                 from /home/tim/Julia/src/julia/src/disasm.cpp:63:
/home/tim/Julia/src/julia/build/dev/usr/include/llvm/ADT/SmallPtrSet.h: In instantiation of 'class llvm::SmallPtrSet<_jl_value_t*, 0>':
/home/tim/Julia/src/julia/build/dev/usr/include/llvm/ADT/SmallSet.h:256:7:   required from 'class llvm::SmallSet<_jl_value_t*, 0>'
/home/tim/Julia/src/julia/src/jitlayers.h:244:31:   required from here
/home/tim/Julia/src/julia/build/dev/usr/include/llvm/ADT/SmallPtrSet.h:462:28: warning: ISO C++ forbids zero-size array [-Wpedantic]
  462 |   const void *SmallStorage[SmallSizePowTwo];
      |                            ^~~~~~~~~~~~~~~
    LINK build/dev/usr/lib/libjulia-codegen.so.1.12.0
    LINK build/dev/usr/lib/libjulia-codegen.so.1.12
    LINK build/dev/usr/lib/libjulia-codegen.so
    JULIA build/dev/usr/lib/julia/basecompiler.ji
julia: /home/tim/Julia/src/julia/build/dev/usr/include/llvm/ADT/SmallPtrSet.h:78: llvm::SmallPtrSetImplBase::SmallPtrSetImplBase(const void**, unsigned int): Assertion `SmallSize && (SmallSize & (SmallSize-1)) == 0 && "Initial size must be a power of two!"' failed.

Introduced by #57961. Given that this isn't a problem on LLVM 19, maybe we only want this on the backports branch?

@maleadt maleadt requested a review from gbaraldi May 13, 2025 10:43
@maleadt maleadt added bugfix This change fixes an existing bug backport 1.12 Change should be backported to release-1.12 labels May 13, 2025
@gbaraldi
Copy link
Member

LGTM

@IanButterworth IanButterworth added the merge me PR is reviewed. Merge when all tests are passing label May 13, 2025
@IanButterworth IanButterworth merged commit 68ba7b6 into master May 13, 2025
11 checks passed
@IanButterworth IanButterworth deleted the tb/smallset branch May 13, 2025 15:43
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label May 14, 2025
@KristofferC KristofferC mentioned this pull request May 20, 2025
58 tasks
@KristofferC KristofferC mentioned this pull request Jun 6, 2025
60 tasks
@KristofferC KristofferC removed the backport 1.12 Change should be backported to release-1.12 label Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants