Skip to content

Check whether the address of a basic block is taken - #724

Merged
maleadt merged 2 commits into
mainfrom
tb/address-taken
Nov 19, 2026
Merged

maleadt merged 2 commits into
mainfrom
tb/address-taken

Conversation

@maleadt

@maleadt maleadt commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Adds bb.address_taken, which wraps BasicBlock::hasAddressTaken: whether a blockaddress constant refers to the block.

JuliaIR.jl's port of Julia's RemoveJuliaAddrspaces needs it. Julia's pass clones a function's body when one of its blocks has its address taken and moves the body otherwise (src/llvm-remove-addrspaces.cpp). Since LLVM 23, a blockaddress keeps its block in a field instead of as an operand, so the block's uses no longer show this. Without a wrapper, the port walks every constant in the module looking for blockaddresses. That walk crashed on an LLVM with assertions when it reached inline assembly, which LLVM.jl types as a Constant but LLVM doesn't treat as a User (JuliaLLVM/JuliaIR.jl#64, found in JuliaGPU/GPUCompiler.jl#1026). With this property, the port can ask each block, as Julia does.

Tests: test/core.jl checks the property on the blockaddress test module. The full suite passes locally on Julia 1.12 (LLVM 18), and with LLVM_TEST_LIBRARY set to a standalone LLVM 23.

The second commit skips the CI jobs that test with libLLVMGPU when deps/LLVMExtra differs from the LLVM.jl revision that LLVMGPU_jll was built from (its README names that revision), and posts a notice instead. LLVMGPU_jll's LLVMExtra lacks any function added since then, so those jobs failed here and would fail on every PR that adds to LLVMExtra, until the JLL is rebuilt.

The last commit bumps LLVMExtra_jll to 0.0.58, built from the first commit, and the version to 10.6.0. LLVMGPU_jll 1.1.0 was built from the same revision, so the libLLVMGPU tests run again.

`bb.address_taken` wraps BasicBlock::hasAddressTaken: whether a `blockaddress` constant
refers to the block. Since LLVM 23, a `blockaddress` keeps its block in a field rather than
as an operand, so this can no longer be derived from the uses of the block. JuliaIR.jl's
port of RemoveJuliaAddrspaces needs it to decide, like Julia's pass, whether a function's
body has to be cloned instead of moved; it now walks every constant in the module instead.
@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main     #724      +/-   ##
==========================================
+ Coverage   94.48%   94.50%   +0.01%     
==========================================
  Files          59       59              
  Lines        8058     8059       +1     
==========================================
+ Hits         7614     7616       +2     
+ Misses        444      443       -1     
Files with missing lines Coverage Δ
src/core/basicblock.jl 98.63% <100.00%> (+0.01%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

LLVMGPU_jll contains an LLVMExtra built from an LLVM.jl release, so a change that adds
a function to LLVMExtra fails these tests until the JLL is rebuilt. The JLL's README
names the LLVM.jl revision it was built from; skip the tests, with a notice, when
deps/LLVMExtra differs from that revision.
@maleadt
maleadt merged commit b6c80c3 into main Nov 19, 2026
59 checks passed
@maleadt
maleadt deleted the tb/address-taken branch November 19, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant