[PATCH] [IndVarSimplify] Widen signed loop compare instructions to enable additional optimizations.

Andrew Trick atrick at apple.com
Fri Sep 12 10:46:38 PDT 2014


I just glanced at this and still want to take a little closer look. In particular I want to understand why LSR behavior changes. Ping me if I don't get back to it.

I generally would not trade a trunc for a sext. But in this case, it probably works out better most of the time. So your change seems reasonable if it doesn't regress things. We definitely want canonical looking loop compares and that must have something to do with LSR behaving better.

Did you also see changes in InstCombine?

I wonder if you'll hit an assertion if both compare operands happen to use the same IV:

j = i*2 - k
cmp i, j

http://reviews.llvm.org/D5333






More information about the llvm-commits mailing list