diff options
author | Michael Kruse <llvm@meinersbur.de> | 2016-03-03 22:10:52 +0000 |
---|---|---|
committer | Michael Kruse <llvm@meinersbur.de> | 2016-03-03 22:10:52 +0000 |
commit | afd2db535118b132b65205360f6c3c3a8bd44291 (patch) | |
tree | 0dfcddf1b7bc1a20423af4a29efe0c9cd5f8bf9e /polly/lib/Support/SCEVValidator.cpp | |
parent | 09eb4451d2a94995fe985d21ec802b7bb262479c (diff) | |
download | bcm5719-llvm-afd2db535118b132b65205360f6c3c3a8bd44291.tar.gz bcm5719-llvm-afd2db535118b132b65205360f6c3c3a8bd44291.zip |
[SCEVValidator] Fix loop exit values considered affine.
Index calculations can use the last value that come out of a loop.
Ideally, ScalarEvolution can compute that exit value directly without
depending on the loop induction variable, but not in all cases.
This changes isAffine to not consider such loop exit values as affine to
avoid that SCEVExpander adds uses of the original loop induction
variable.
This fix is analogous to r262404 that applies to general uses of loop
exit values instead of index expressions and loop bouds as in this
patch.
This reduces the number of LNT test-suite fails with
-polly-position=before-vectorizer -polly-unprofitable
from 10 to 8.
llvm-svn: 262665
Diffstat (limited to 'polly/lib/Support/SCEVValidator.cpp')
-rw-r--r-- | polly/lib/Support/SCEVValidator.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/polly/lib/Support/SCEVValidator.cpp b/polly/lib/Support/SCEVValidator.cpp index 24139908c5d..0bece55de0a 100644 --- a/polly/lib/Support/SCEVValidator.cpp +++ b/polly/lib/Support/SCEVValidator.cpp @@ -267,7 +267,14 @@ public: if (!Recurrence.isValid()) return Recurrence; - if (R->contains(Expr->getLoop())) { + auto *L = Expr->getLoop(); + if (R->contains(L) && (!Scope || !L->contains(Scope))) { + DEBUG(dbgs() << "INVALID: AddRec out of a loop whose exit value is not " + "synthesizable"); + return ValidatorResult(SCEVType::INVALID); + } + + if (R->contains(L)) { if (Recurrence.isINT()) { ValidatorResult Result(SCEVType::IV); Result.addParamsFrom(Start); |