[llvm] [LLVM] Remove nuw neg (PR #86295)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 09:18:03 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()
----------------
goldsteinn wrote:

Why is dropping the `nuw` APIs from neg related to this fixing the bug?Should this be independent commits?

https://github.com/llvm/llvm-project/pull/86295


More information about the llvm-commits mailing list