[SCEV] Fix PR36974.

The patch changes the usage of dominate to properlyDominate
to satisfy the condition !(a < a) while using std::max.

It is actually NFC due to set data structure is used to keep
the Loops and no two identical loops can be in collection.
So in reality there is no difference between usage of
dominate and properlyDominate in this particular case.
However it might be changed so it is better to fix it.

llvm-svn: 329051
This commit is contained in:
Serguei Katkov 2018-04-03 07:29:00 +00:00
parent b0c403d7ae
commit 2ace8dc1c3
1 changed files with 6 additions and 5 deletions

View File

@ -8668,11 +8668,12 @@ bool ScalarEvolution::isKnownViaInduction(ICmpInst::Predicate Pred,
DT.dominates(L2->getHeader(), L1->getHeader())) &&
"Domination relationship is not a linear order");
#endif
const Loop *MDL = *std::max_element(LoopsUsed.begin(), LoopsUsed.end(),
[&](const Loop *L1, const Loop *L2) {
return DT.dominates(L1->getHeader(), L2->getHeader());
});
const Loop *MDL =
*std::max_element(LoopsUsed.begin(), LoopsUsed.end(),
[&](const Loop *L1, const Loop *L2) {
return DT.properlyDominates(L1->getHeader(), L2->getHeader());
});
// Get init and post increment value for LHS.
auto SplitLHS = SplitIntoInitAndPostInc(MDL, LHS);