[PATCH] D25913: [InstCombine] Fold nuw left-shifts in `ugt`/`ule` comparisons.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 14:22:02 PDT 2016


efriedma added a comment.

"X <u 0" should be reliably folded to "false" before you reach this point, if that's the question... InstSimplify always runs before any other InstCombine transform.  Maybe add an assert to be on the safe side.

Not sure about "X >u 0" -> "X != 0"; I think that actually happens later, although I guess it doesn't matter in this context.



================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:1963
+    // (X << S) <=u C = X <=u (C >> S)
+    // (X << S) <u (C + 1) = X <u (C >> S) + 1 if C < - 1
+    // (X << S) <u C = X <u ((C - 1) >> S) + 1 if C > 0
----------------
"// (X << S) <u (C + 1) = X <u (C >> S) + 1 if C < - 1"

This comment is confusing... when exactly is "C < - 1" true?


Repository:
  rL LLVM

https://reviews.llvm.org/D25913





More information about the llvm-commits mailing list