Fix SCEVExpander: don't try to expand quadratic recurrences outside a loop.
authorAndrew Trick <atrick@apple.com>
Fri, 25 Oct 2013 21:35:56 +0000 (21:35 +0000)
committerAndrew Trick <atrick@apple.com>
Fri, 25 Oct 2013 21:35:56 +0000 (21:35 +0000)
commit4d4bbaf997c16f9e79503bd640306d784efd090e
treedce5058bb8c237bdf493aabc2ebf4af4e9e8fbbd
parent8aa8cea3e964796187f8682e502a8446b3ce02e1
Fix SCEVExpander: don't try to expand quadratic recurrences outside a loop.

Partial fix for PR17459: wrong code at -O3 on x86_64-linux-gnu
(affecting trunk and 3.3)

When SCEV expands a recurrence outside of a loop it attempts to scale
by the stride of the recurrence. Chained recurrences don't work that
way. We could compute binomial coefficients, but would hve to
guarantee that the chained AddRec's are in a perfectly reduced form.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193438 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolutionExpander.h
lib/Analysis/ScalarEvolutionExpander.cpp
lib/Transforms/Scalar/IndVarSimplify.cpp
lib/Transforms/Scalar/LoopStrengthReduce.cpp
test/Transforms/LoopStrengthReduce/lsr-expand-quadratic.ll [new file with mode: 0644]