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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 5 08:58:32 PDT 2020


nikic marked an inline comment as done.
nikic 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())
----------------
lebedev.ri wrote:
> 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`.
> 
Uh yeah, this didn't make sense. I couldn't think of a good name, so I ended up inverting the return value.


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

https://reviews.llvm.org/D87196



More information about the llvm-commits mailing list