-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[ConstantFolding] Fold scalable get_active_lane_masks #156659
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4238,6 +4238,13 @@ static Constant *ConstantFoldScalableVectorCall( | |
|
|
||
| return ConstantInt::getFalse(SVTy); | ||
| } | ||
| case Intrinsic::get_active_lane_mask: { | ||
| auto Op0 = cast<ConstantInt>(Operands[0])->getValue(); | ||
| auto Op1 = cast<ConstantInt>(Operands[1])->getValue(); | ||
|
Comment on lines
+4242
to
+4243
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is currently causing crashes when the operands are constant expressions. I added checks to. make sure the operands are actually ConstantInts in 607a813 to avoid a revert.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for that, much appreciated. |
||
| if ((Op0.uge(Op1) && (!Op1.isZero()))) | ||
|
||
| return ConstantVector::getNullValue(SVTy); | ||
| break; | ||
| } | ||
| default: | ||
| break; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we probably want to do this for fixed-width as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it stands, ConstantFolding can already handle this for fixed-width. Scalable seems to have been left behind: https://godbolt.org/z/snd7M5oer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see yeah, and as it stands the code in
ConstantFoldFixedVectorCallis broken because it should return poison ifOp1is zero. Once the LangRef is fixed we can always revisit this.