Adding IV chain generation to LSR.
authorAndrew Trick <atrick@apple.com>
Mon, 9 Jan 2012 21:18:52 +0000 (21:18 +0000)
committerAndrew Trick <atrick@apple.com>
Mon, 9 Jan 2012 21:18:52 +0000 (21:18 +0000)
commit22d20c218aeb14af388bff2346d6d4cc131e8449
tree59dd0d702af2af9b44cf144fc422de97436f1221
parent6c7d0ae8dc8beb37efd6c0ff586035253856e07c
Adding IV chain generation to LSR.

After collecting chains, check if any should be materialized. If so,
hide the chained IV users from the LSR solver. LSR will only solve for
the head of the chain. GenerateIVChains will then materialize the
chained IV users by computing the IV relative to its previous value in
the chain.

In theory, chained IV users could be exposed to LSR's solver. This
would be considerably complicated to implement and I'm not aware of a
case where we need it. In practice it's more important to
intelligently prune the search space of nontrivial loops before
running the solver, otherwise the solver is often forced to prune the
most optimal solutions. Hiding the chained users does this well, so
that LSR is more likely to find the best IV for the chain as a whole.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147801 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/LoopStrengthReduce.cpp
test/Transforms/LoopStrengthReduce/X86/ivchain-stress-X86.ll [new file with mode: 0644]