diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2017-10-27 04:17:44 +0000 |
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2017-10-27 04:17:44 +0000 |
| commit | 52d0a49046f0393b315b5743c5f341ebc6b1da06 (patch) | |
| tree | 31f44177428b65ddf3be30c733367f8f1d62ee55 /llvm/lib/Analysis | |
| parent | f9c66e4b80038d4c079515f7ea884d6d9a3d848a (diff) | |
| download | bcm5719-llvm-52d0a49046f0393b315b5743c5f341ebc6b1da06.tar.gz bcm5719-llvm-52d0a49046f0393b315b5743c5f341ebc6b1da06.zip | |
Revert rL316568 because of sudden performance drop on ARM
llvm-svn: 316739
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index 964a79803fa..47bdac00ae1 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -2250,6 +2250,10 @@ namespace { // only needed when the expression includes some subexpression that is not IV // derived. // +// Currently, we only allow division by a nonzero constant here. If this is +// inadequate, we could easily allow division by SCEVUnknown by using +// ValueTracking to check isKnownNonZero(). +// // We cannot generally expand recurrences unless the step dominates the loop // header. The expander handles the special case of affine recurrences by // scaling the recurrence outside the loop, but this technique isn't generally @@ -2264,11 +2268,13 @@ struct SCEVFindUnsafe { bool follow(const SCEV *S) { if (const SCEVUDivExpr *D = dyn_cast<SCEVUDivExpr>(S)) { - if (!SE.isKnownNonZero(D->getRHS())) { + const SCEVConstant *SC = dyn_cast<SCEVConstant>(D->getRHS()); + if (!SC || SC->getValue()->isZero()) { IsUnsafe = true; return false; } - } else if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(S)) { + } + if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(S)) { const SCEV *Step = AR->getStepRecurrence(SE); if (!AR->isAffine() && !SE.dominates(Step, AR->getLoop()->getHeader())) { IsUnsafe = true; |

