[llvm] [LLVM] Remove nuw neg (PR #86295)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 08:29:21 PDT 2024
================
@@ -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()
----------------
dtcxzyw wrote:
This change fixes a regression caused by not propagating nuw flags.
https://github.com/llvm/llvm-project/pull/86295
More information about the llvm-commits
mailing list