diff options
| author | Andrew Trick <atrick@apple.com> | 2013-10-25 21:35:56 +0000 |
|---|---|---|
| committer | Andrew Trick <atrick@apple.com> | 2013-10-25 21:35:56 +0000 |
| commit | 57243da70f5a4b6a29566c38a2a2de0b4e1c7d16 (patch) | |
| tree | 7f864d5a4c0bc7e95743c9bcea624ced2a2cf7ed /llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | |
| parent | 29abce3189af936b74f880ab1ba7114eb6de7ac9 (diff) | |
| download | bcm5719-llvm-57243da70f5a4b6a29566c38a2a2de0b4e1c7d16.tar.gz bcm5719-llvm-57243da70f5a4b6a29566c38a2a2de0b4e1c7d16.zip | |
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.
llvm-svn: 193438
Diffstat (limited to 'llvm/lib/Transforms/Scalar/IndVarSimplify.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index cfd8db0f6cc..235aaaa6f80 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -532,7 +532,8 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) { // and varies predictably *inside* the loop. Evaluate the value it // contains when the loop exits, if possible. const SCEV *ExitValue = SE->getSCEVAtScope(Inst, L->getParentLoop()); - if (!SE->isLoopInvariant(ExitValue, L) || !isSafeToExpand(ExitValue)) + if (!SE->isLoopInvariant(ExitValue, L) || + !isSafeToExpand(ExitValue, *SE)) continue; // Computing the value outside of the loop brings no benefit if : |

