[PATCH] D60061: [InstCombine] ssubo X, C -> saddo X, -C

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 06:01:30 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:2160-2164
+    if (match(Arg1, m_APInt(C)) &&
+        !(C->isMinSignedValue() || C->isMaxSignedValue())) {
+      // Create a copy of the original constant and negate it.
+      APInt NewC = APInt(*C);
+      NewC.negate();
----------------
Hmm, why not just:
```
APInt NewC;
if (match(Arg1, m_APInt(C)) &&
    !subWithOverflow(NewC, 0, *C, /*IsSigned=*/II->getIntrinsicID() == Intrinsic::ssub_with_overflow)) {
```
?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60061/new/

https://reviews.llvm.org/D60061





More information about the llvm-commits mailing list