Enable LSR IV Chains with sufficient heuristics.
authorAndrew Trick <atrick@apple.com>
Tue, 10 Jan 2012 01:45:08 +0000 (01:45 +0000)
committerAndrew Trick <atrick@apple.com>
Tue, 10 Jan 2012 01:45:08 +0000 (01:45 +0000)
commit64925c55c65f9345a69fb67db07aa62cfb723577
treed8f1f3ef87b2f4f6a8c70b1fd1ffdb130198cbcd
parentdae412bd320f1522bd1d850be0276212fca0331f
Enable LSR IV Chains with sufficient heuristics.

These heuristics are sufficient for enabling IV chains by
default. Performance analysis has been done for i386, x86_64, and
thumbv7. The optimization is rarely important, but can significantly
speed up certain cases by eliminating spill code within the
loop. Unrolled loops are prime candidates for IV chains. In many
cases, the final code could still be improved with more target
specific optimization following LSR. The goal of this feature is for
LSR to make the best choice of induction variables.

Instruction selection may not completely take advantage of this
feature yet. As a result, there could be cases of slight code size
increase.

Code size can be worse on x86 because it doesn't support postincrement
addressing. In fact, when chains are formed, you may see redundant
address plus stride addition in the addressing mode. GenerateIVChains
tries to compensate for the common cases.

On ARM, code size increase can be mitigated by using postincrement
addressing, but downstream codegen currently misses some opportunities.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147826 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolutionExpander.h
lib/Analysis/ScalarEvolutionExpander.cpp
lib/Transforms/Scalar/LoopStrengthReduce.cpp
test/Transforms/LoopStrengthReduce/ARM/dg.exp [new file with mode: 0644]
test/Transforms/LoopStrengthReduce/ARM/ivchain-ARM.ll [new file with mode: 0644]
test/Transforms/LoopStrengthReduce/X86/ivchain-X86.ll [new file with mode: 0644]