Skip to content

Support handling new attributes#556

Merged
vchuravy merged 4 commits into
masterfrom
vc/attr
May 7, 2026
Merged

Support handling new attributes#556
vchuravy merged 4 commits into
masterfrom
vc/attr

Conversation

@vchuravy
Copy link
Copy Markdown
Collaborator

@vchuravy vchuravy commented May 7, 2026

Upstream PR: llvm/llvm-project#196312
Noticed when trying to run Enzyme on Julia 1.13

LLVM 17+ introduced `range` (ConstantRange) and LLVM 20+ introduced
`initializes` (ConstantRangeList) attribute kinds that the C API's
LLVMIsEnumAttribute/LLVMIsStringAttribute/LLVMIsTypeAttribute do not
recognize, causing `Attribute(ref)` to error with "unknown attribute kind".

Add LLVMIsConstantRangeAttribute (LLVM >= 17) and
LLVMIsConstantRangeListAttribute (LLVM >= 20) to LLVMExtra, expose them
in the per-version Julia bindings, and use them to dispatch to new
ConstantRangeAttribute and ConstantRangeListAttribute types.

Also adds a ConstantRangeAttribute constructor (LLVM >= 19, when
LLVMCreateConstantRangeAttribute was upstreamed via llvm/llvm-project#90505)
and a test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/core/attributes.jl 62.50% 3 Missing ⚠️
src/core/instructions.jl 0.00% 2 Missing ⚠️
src/core/function.jl 50.00% 1 Missing ⚠️
@@            Coverage Diff             @@
##           master     #556      +/-   ##
==========================================
- Coverage   86.05%   85.90%   -0.15%     
==========================================
  Files          47       47              
  Lines        2968     2980      +12     
==========================================
+ Hits         2554     2560       +6     
- Misses        414      420       +6     
Files with missing lines Coverage Δ
src/core/function.jl 98.34% <50.00%> (-0.82%) ⬇️
src/core/instructions.jl 81.76% <0.00%> (-0.98%) ⬇️
src/core/attributes.jl 85.00% <62.50%> (-5.63%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

vchuravy and others added 3 commits May 7, 2026 16:08
Delete the attribute after testing it so the subsequent length == 0 check passes on LLVM >= 19.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The function was added to LLVM main in March 2024 (after LLVM 18 branched)
and first appeared in LLVM 19.x. Building with LLVM 18 fails because
isConstantRangeAttribute() does not exist in that release.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both FunctionAttrSet and CallSiteAttrSet were missing delete! methods for
these attribute kinds, causing a MethodError in the test suite.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vchuravy vchuravy merged commit 4bb3674 into master May 7, 2026
34 checks passed
@vchuravy vchuravy deleted the vc/attr branch May 7, 2026 19:36
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