[PATCH] D85043: [InstSimplify] simplify abs if operand is known non-negative

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 14:33:52 PDT 2020


nikic added a comment.

Yes, we should be fine compile-time wise. The icmp + select representation of abs implicitly did this as well, because we fold comparisons against zero more aggressively than others.



================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:5260
+    // If the sign bit is clear already, then abs does not do anything.
+    if (isKnownNonNegative(Op0, Q.DL))
+      return Op0;
----------------
We should also pass through `Q.AC, Q.CxtI, Q.DT`.


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

https://reviews.llvm.org/D85043



More information about the llvm-commits mailing list