feat(LLVM): parse llvm.call_intrinsic - #1407
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tobiasgrosser
force-pushed
the
tobias/llvm_call_intrinsic
branch
from
September 7, 2026 06:23
5fb4c84 to
224baef
Compare
tobiasgrosser
requested review from
luisacicolini,
mafeguimaraes,
math-fehr and
regehr
September 7, 2026 10:08
Share the operand bundle checks of llvm.intr.assume through a new verifyOperandBundles helper, so call_intrinsic also rejects missing or non-string tags and non-i32 sizes. Require the llvm. name prefix and a region-free op, check operandSegmentSizes is i32, and reuse the fast-math parser. The negative tests now also run MLIR_INVALID. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
math-fehr
reviewed
Sep 7, 2026
| throw "Expected 0 successors" | ||
| pure () | ||
| | .call_intrinsic => do | ||
| op.checkIsNonNullIntegerType ctx opIn |
Collaborator
There was a problem hiding this comment.
This only checks that it is not a i0. So things like vector, index, felt, are still allowed from this.
I'm pretty sure that most other operations are also buggy in that way :/
math-fehr
approved these changes
Sep 7, 2026
math-fehr
left a comment
Collaborator
There was a problem hiding this comment.
There is a bug due to OperationPtr.checkIsNonNullIntegerType being wrong, but otherwise I think it's fine so far
checkIsNonNullIntegerType only rejects i0, so operands and results of type index, felt or similar slipped through. Add Attribute.isLLVMCompatibleType and verifyLLVMCompatibleTypes to the verifier utilities and apply them to call_intrinsic. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
llvm.call_intrinsic, the op MLIR uses for LLVM intrinsics without a dedicated op, with the properties clang emits:intrin,operandSegmentSizes,op_bundle_sizes,op_bundle_tags,fastmathFlags,arg_attrsandres_attrs. The verifier mirrors MLIR's: the name must start withllvm., at most one result, no regions,operandSegmentSizesmust be an i32 array matching the operands, and the bundle sizes and tags must be consistent. The bundle checks are shared withllvm.intr.assumethrough a newverifyOperandBundleshelper, which also makes that op reject non-i32 sizes and missing or non-string tags the same way. Effects stay.unknown, since they depend on the intrinsic name.🤖 Generated with Claude Code