If a loop termination compare instruction is the only use of its stride,
authorEvan Cheng <evan.cheng@apple.com>
Thu, 25 Oct 2007 09:11:16 +0000 (09:11 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 25 Oct 2007 09:11:16 +0000 (09:11 +0000)
commitcdf43b1fadac74ecf1cc858e72bde877a10ceca1
treedbe5f72d6627c34e03dc0526d6936d32f2eb8697
parentddaa61d8b5f9af9f8f0ea5348c413bb9a9321bbc
If a loop termination compare instruction is the only use of its stride,
and the compaison is against a constant value, try eliminate the stride
by moving the compare instruction to another stride and change its
constant operand accordingly. e.g.

loop:
...
v1 = v1 + 3
v2 = v2 + 1
if (v2 < 10) goto loop
=>
loop:
...
v1 = v1 + 3
if (v1 < 30) goto loop

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43336 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/LoopStrengthReduce.cpp
test/CodeGen/X86/loop-strength-reduce3.ll [new file with mode: 0644]
test/CodeGen/X86/loop-strength-reduce4.ll [new file with mode: 0644]