summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2017-05-21 05:02:12 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2017-05-21 05:02:12 +0000
commit8963650cfa04a60dbb51e4bd27b9fefeb51ab71b (patch)
treea7fc16eba5dfaeb8deb3ed51cfa3fe86e2345e98 /llvm/lib
parent52071683836a749cb827a4aa8c2969ec9cade1c9 (diff)
downloadbcm5719-llvm-8963650cfa04a60dbb51e4bd27b9fefeb51ab71b.tar.gz
bcm5719-llvm-8963650cfa04a60dbb51e4bd27b9fefeb51ab71b.zip
Revert "[SCEV] Clarify behavior around max backedge taken count"
This reverts commit r303497 since it breaks the msan bootstrap bot: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/1379/ llvm-svn: 303498
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp47
1 files changed, 10 insertions, 37 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 78ded8141c0..3f3e8cebb24 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -5947,8 +5947,6 @@ ScalarEvolution::BackedgeTakenInfo::getMax(ScalarEvolution *SE) const {
if (any_of(ExitNotTaken, PredicateNotAlwaysTrue) || !getMax())
return SE->getCouldNotCompute();
- assert((isa<SCEVCouldNotCompute>(getMax()) || isa<SCEVConstant>(getMax())) &&
- "No point in having a non-constant max backedge taken count!");
return getMax();
}
@@ -5974,11 +5972,7 @@ bool ScalarEvolution::BackedgeTakenInfo::hasOperand(const SCEV *S,
}
ScalarEvolution::ExitLimit::ExitLimit(const SCEV *E)
- : ExactNotTaken(E), MaxNotTaken(E), MaxOrZero(false) {
- assert((isa<SCEVCouldNotCompute>(MaxNotTaken) ||
- isa<SCEVConstant>(MaxNotTaken)) &&
- "No point in having a non-constant max backedge taken count!");
-}
+ : ExactNotTaken(E), MaxNotTaken(E), MaxOrZero(false) {}
ScalarEvolution::ExitLimit::ExitLimit(
const SCEV *E, const SCEV *M, bool MaxOrZero,
@@ -5987,9 +5981,6 @@ ScalarEvolution::ExitLimit::ExitLimit(
assert((isa<SCEVCouldNotCompute>(ExactNotTaken) ||
!isa<SCEVCouldNotCompute>(MaxNotTaken)) &&
"Exact is not allowed to be less precise than Max");
- assert((isa<SCEVCouldNotCompute>(MaxNotTaken) ||
- isa<SCEVConstant>(MaxNotTaken)) &&
- "No point in having a non-constant max backedge taken count!");
for (auto *PredSet : PredSetList)
for (auto *P : *PredSet)
addPredicate(P);
@@ -5998,19 +5989,11 @@ ScalarEvolution::ExitLimit::ExitLimit(
ScalarEvolution::ExitLimit::ExitLimit(
const SCEV *E, const SCEV *M, bool MaxOrZero,
const SmallPtrSetImpl<const SCEVPredicate *> &PredSet)
- : ExitLimit(E, M, MaxOrZero, {&PredSet}) {
- assert((isa<SCEVCouldNotCompute>(MaxNotTaken) ||
- isa<SCEVConstant>(MaxNotTaken)) &&
- "No point in having a non-constant max backedge taken count!");
-}
+ : ExitLimit(E, M, MaxOrZero, {&PredSet}) {}
ScalarEvolution::ExitLimit::ExitLimit(const SCEV *E, const SCEV *M,
bool MaxOrZero)
- : ExitLimit(E, M, MaxOrZero, None) {
- assert((isa<SCEVCouldNotCompute>(MaxNotTaken) ||
- isa<SCEVConstant>(MaxNotTaken)) &&
- "No point in having a non-constant max backedge taken count!");
-}
+ : ExitLimit(E, M, MaxOrZero, None) {}
/// Allocate memory for BackedgeTakenInfo and copy the not-taken count of each
/// computable exit into a persistent ExitNotTakenInfo array.
@@ -6035,8 +6018,6 @@ ScalarEvolution::BackedgeTakenInfo::BackedgeTakenInfo(
return ExitNotTakenInfo(ExitBB, EL.ExactNotTaken, std::move(Predicate));
});
- assert((isa<SCEVCouldNotCompute>(MaxCount) || isa<SCEVConstant>(MaxCount)) &&
- "No point in having a non-constant max backedge taken count!");
}
/// Invalidate this result and free the ExitNotTakenInfo array.
@@ -6298,7 +6279,7 @@ ScalarEvolution::ExitLimit ScalarEvolution::computeExitLimitFromCondImpl(
// to not.
if (isa<SCEVCouldNotCompute>(MaxBECount) &&
!isa<SCEVCouldNotCompute>(BECount))
- MaxBECount = getConstant(getUnsignedRange(BECount).getUnsignedMax());
+ MaxBECount = BECount;
return ExitLimit(BECount, MaxBECount, false,
{&EL0.Predicates, &EL1.Predicates});
@@ -7602,20 +7583,13 @@ ScalarEvolution::howFarToZero(const SCEV *V, const Loop *L, bool ControlsExit,
loopHasNoAbnormalExits(AddRec->getLoop())) {
const SCEV *Exact =
getUDivExpr(Distance, CountDown ? getNegativeSCEV(Step) : Step);
- const SCEV *Max =
- Exact == getCouldNotCompute()
- ? Exact
- : getConstant(getUnsignedRange(Exact).getUnsignedMax());
- return ExitLimit(Exact, Max, false, Predicates);
+ return ExitLimit(Exact, Exact, false, Predicates);
}
// Solve the general equation.
- const SCEV *E = SolveLinEquationWithOverflow(StepC->getAPInt(),
- getNegativeSCEV(Start), *this);
- const SCEV *M = E == getCouldNotCompute()
- ? E
- : getConstant(getUnsignedRange(E).getUnsignedMax());
- return ExitLimit(E, M, false, Predicates);
+ const SCEV *E = SolveLinEquationWithOverflow(
+ StepC->getAPInt(), getNegativeSCEV(Start), *this);
+ return ExitLimit(E, E, false, Predicates);
}
ScalarEvolution::ExitLimit
@@ -9244,9 +9218,8 @@ ScalarEvolution::howManyLessThans(const SCEV *LHS, const SCEV *RHS,
getConstant(StrideForMaxBECount), false);
}
- if (isa<SCEVCouldNotCompute>(MaxBECount) &&
- !isa<SCEVCouldNotCompute>(BECount))
- MaxBECount = getConstant(getUnsignedRange(BECount).getUnsignedMax());
+ if (isa<SCEVCouldNotCompute>(MaxBECount))
+ MaxBECount = BECount;
return ExitLimit(BECount, MaxBECount, MaxOrZero, Predicates);
}
OpenPOWER on IntegriCloud