-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[LLVM] Remove nuw neg #86295
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
[LLVM] Remove nuw neg #86295
Changes from all commits
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 |
---|---|---|
|
@@ -4250,10 +4250,11 @@ static Instruction *canonicalizeAbs(BinaryOperator &Xor, | |
// xor (add A, Op1), Op1 ; add -1 and flip bits if negative | ||
// --> (A < 0) ? -A : A | ||
Value *IsNeg = Builder.CreateIsNeg(A); | ||
// Copy the nuw/nsw flags from the add to the negate. | ||
// Copy the nsw flags from the add to the negate. | ||
auto *Add = cast<BinaryOperator>(Op0); | ||
Value *NegA = Builder.CreateNeg(A, "", Add->hasNoUnsignedWrap(), | ||
Add->hasNoSignedWrap()); | ||
Value *NegA = Add->hasNoUnsignedWrap() | ||
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 change fixes a regression caused by not propagating nuw flags. 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. Why is dropping the 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. I don't know if it is OK to drop these changes and leave the regression. 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. Oh I see what you mean. I misunderstood and thought you meant this patch was really all about this little fix here. |
||
? Constant::getNullValue(A->getType()) | ||
: Builder.CreateNeg(A, "", Add->hasNoSignedWrap()); | ||
return SelectInst::Create(IsNeg, NegA, A); | ||
} | ||
return nullptr; | ||
|
Uh oh!
There was an error while loading. Please reload this page.