summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2018-02-05 05:49:47 +0000
committerSerguei Katkov <serguei.katkov@azul.com>2018-02-05 05:49:47 +0000
commitec7029c286c6a8e49db52c752d87c9ff0a465996 (patch)
tree5d110a63275ed8cbba83a56249ee9facec9f2f1d /llvm/lib/Transforms
parent0923542c61cdbaa255c4336575c4b21d0c6779e8 (diff)
downloadbcm5719-llvm-ec7029c286c6a8e49db52c752d87c9ff0a465996.tar.gz
bcm5719-llvm-ec7029c286c6a8e49db52c752d87c9ff0a465996.zip
Re-apply [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. To bugs additionally fixed: assert is moved after the check whether loop is not a nullptr. Usage of isLoopEntryGuardedByCond in ScalarEvolution::isImpliedCondOperandsViaNoOverflow is guarded by isAvailableAtLoopEntry. Reviewers: sanjoy, mkazantsev, anna, dorit, reames Reviewed By: mkazantsev Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D42417 llvm-svn: 324204
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
index 6a63476fcc3..11ad4275f78 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;
}
OpenPOWER on IntegriCloud