[PATCH] D47041: [ValueTracking] Teach computeKnownBits that the result of an absolute value pattern that uses nsw flag is always positive.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 18 11:28:19 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:1085
+      // will be 0 because that makes abs(INT_MIN) undefined.
+      if (cast<Instruction>(RHS)->hasNoSignedWrap())
+        MaxHighZeros = 1;
----------------
dmgreen wrote:
> Can't RHS be a const?
This patch is dependent on another patch where I made matchSelectPattern return the negation portion in RHS. Previously it always returned a 0, 1, or -1 constant which was failry useless.


https://reviews.llvm.org/D47041





More information about the llvm-commits mailing list