[IndVars] Canonicalize comparisons between non-negative values and indvars


[IndVars] Canonicalize comparisons between non-negative values and indvars

-If there is a IndVar which is known to be non-negative, and there is a value which is also non-negative,
then signed and unsigned comparisons between them produce the same result. Both of those can be
seen in the same loop. To allow other optimizations to simplify them, we turn all instructions like

%c = icmp slt i32 %iv, %b


%c = icmp ult i32 %iv, %b

if both %iv and %b are known to be non-negative.

Differential Revision: https://reviews.llvm.org/D34979

Event Timeline

Reverted as https://reviews.llvm.org/rL307135 because of broken test MathExtras.SaturatingMultiply on clang.

rovka added a subscriber: rovka.Jul 5 2017, 3:50 AM

Hi, I just wanted to point out that this change also slows down some test-suite apps on ARM, as you can see here:

I'll try to investigate if those tests are too close to the timeout limit, but I thought I should point it out first.

rovka added a comment.Jul 5 2017, 4:11 AM

Oops, I looked into it more closely and they're not timeouts, they're real issues:
Execution Context Diff:
/home/buildslave/buildslave/clang-native-arm-lnt/test/sandbox/build/tools/fpcmp: files differ without tolerance allowance