Don't break the IV update in TLI::SimplifySetCC().
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 5 Apr 2012 20:30:20 +0000 (20:30 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 5 Apr 2012 20:30:20 +0000 (20:30 +0000)
commit740cd657f3d9d4e88614831c70a649f9257164da
tree55acdd0c3c13cc20ea4e1b1863f80b4cc62f21f8
parent036ebfd87434bc30a0e51f4b9a3d55ab49ee5509
Don't break the IV update in TLI::SimplifySetCC().

LSR always tries to make the ICmp in the loop latch use the incremented
induction variable. This allows the induction variable to be kept in a
single register.

When the induction variable limit is equal to the stride,
SimplifySetCC() would break LSR's hard work by transforming:

   (icmp (add iv, stride), stride) --> (cmp iv, 0)

This forced us to use lea for the IC update, preventing the simpler
incl+cmp.

<rdar://problem/7643606>
<rdar://problem/11184260>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154119 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/TargetLowering.cpp
test/CodeGen/Thumb2/lsr-deficiency.ll
test/CodeGen/X86/lsr-loop-exit-cond.ll