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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 17 17:19:24 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:1086
+      if (cast<Instruction>(RHS)->hasNoSignedWrap())
+        MaxHighZeros = 1;
     }
----------------
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...


https://reviews.llvm.org/D47041





More information about the llvm-commits mailing list