diff options
| author | Serguei Katkov <serguei.katkov@azul.com> | 2018-01-22 07:31:41 +0000 |
|---|---|---|
| committer | Serguei Katkov <serguei.katkov@azul.com> | 2018-01-22 07:31:41 +0000 |
| commit | 50714a1cbc9b0f49e0dff961ffb50fd80668b250 (patch) | |
| tree | a0b9e0ffffbefc26daf54a949b8b1e0b6f956dd6 /llvm/lib/Transforms | |
| parent | bb3c570633d67e3a0c80992b09f9743fb2e2ea78 (diff) | |
| download | bcm5719-llvm-50714a1cbc9b0f49e0dff961ffb50fd80668b250.tar.gz bcm5719-llvm-50714a1cbc9b0f49e0dff961ffb50fd80668b250.zip | |
[SCEV] Fix isLoopEntryGuardedByCond usage
ScalarEvolution::isKnownPredicate invokes isLoopEntryGuardedByCond without check
that SCEV is available at entry point of the loop. It is incorrect and fixed by patch.
Reviewers: sanjoy, mkazantsev, anna, dorit
Reviewed By: mkazantsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42165
llvm-svn: 323077
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp index c8e58a1e93a..1af77d84f85 100644 --- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp +++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp @@ -934,9 +934,9 @@ LoopStructure::parseLoopStructure(ScalarEvolution &SE, return None; } - if (!SE.isLoopEntryGuardedByCond( - &L, BoundPred, IndVarStart, - SE.getAddExpr(RightSCEV, Step))) { + if (!SE.isAvailableAtLoopEntry(RightSCEV, &L) || + !SE.isLoopEntryGuardedByCond(&L, BoundPred, IndVarStart, + SE.getAddExpr(RightSCEV, Step))) { FailureReason = "Induction variable start not bounded by upper limit"; return None; } @@ -948,7 +948,8 @@ LoopStructure::parseLoopStructure(ScalarEvolution &SE, RightValue = B.CreateAdd(RightValue, One); } } else { - if (!SE.isLoopEntryGuardedByCond(&L, BoundPred, IndVarStart, RightSCEV)) { + if (!SE.isAvailableAtLoopEntry(RightSCEV, &L) || + !SE.isLoopEntryGuardedByCond(&L, BoundPred, IndVarStart, RightSCEV)) { FailureReason = "Induction variable start not bounded by upper limit"; return None; } @@ -1014,9 +1015,10 @@ LoopStructure::parseLoopStructure(ScalarEvolution &SE, return None; } - if (!SE.isLoopEntryGuardedByCond( - &L, BoundPred, IndVarStart, - SE.getMinusSCEV(RightSCEV, SE.getOne(RightSCEV->getType())))) { + if (!SE.isAvailableAtLoopEntry(RightSCEV, &L) || + !SE.isLoopEntryGuardedByCond( + &L, BoundPred, IndVarStart, + SE.getMinusSCEV(RightSCEV, SE.getOne(RightSCEV->getType())))) { FailureReason = "Induction variable start not bounded by lower limit"; return None; } @@ -1028,7 +1030,8 @@ LoopStructure::parseLoopStructure(ScalarEvolution &SE, RightValue = B.CreateSub(RightValue, One); } } else { - if (!SE.isLoopEntryGuardedByCond(&L, BoundPred, IndVarStart, RightSCEV)) { + if (!SE.isAvailableAtLoopEntry(RightSCEV, &L) || + !SE.isLoopEntryGuardedByCond(&L, BoundPred, IndVarStart, RightSCEV)) { FailureReason = "Induction variable start not bounded by lower limit"; return None; } |

