[PATCH] D25913: [InstCombine] Fold nuw left-shifts in `ugt`/`ule` comparisons.
bryant via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 26 15:23:42 PDT 2016
bryant added inline comments.
================
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
----------------
efriedma wrote:
> "// (X << S) <u (C + 1) = X <u (C >> S) + 1 if C < - 1"
>
> This comment is confusing... when exactly is "C < - 1" true?
-1 == all ones. Assuming that addition wraps, `X <=u C` is equivalent to `X <=u (C + 1)` if C + 1 doesn't wrap, or if C is less than all ones.
Repository:
rL LLVM
https://reviews.llvm.org/D25913
More information about the llvm-commits
mailing list