[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
Thu May 17 18:34:51 PDT 2018


craig.topper added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:1086
+      if (cast<Instruction>(RHS)->hasNoSignedWrap())
+        MaxHighZeros = 1;
     }
----------------
efriedma wrote:
> Can you write a similar pattern for SPF_NABS?
> 
> We could save a bit of computation by not calling ComputeKnownBits on both x and -x, but it's probably not worth bothering...
I don't think SPF_NABS has a sign bit guarantee. NABS of 0 is still 0. NABS of anything else is negative.


https://reviews.llvm.org/D47041





More information about the llvm-commits mailing list