[PATCH] D87196: [InstCombine] Fold abs of known negative operand

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 5 08:47:30 PDT 2020


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:664-665
+  KnownBits Known = computeKnownBits(Op, DL, 0, AC, CxtI, DT);
+  if (Known.isNonNegative())
+    return true;
+  if (Known.isNegative())
----------------
Either the function should have other name, or the return value pattern should be inverted,
because if the value is negative, we for sure know that the sign is `1`, not `0`.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87196



More information about the llvm-commits mailing list