From 2ace8dc1c334b8be5a02a27d2970ce0dae163a19 Mon Sep 17 00:00:00 2001 From: Serguei Katkov Date: Tue, 3 Apr 2018 07:29:00 +0000 Subject: [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 --- llvm/lib/Analysis/ScalarEvolution.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp') diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index d8a41944acb..fad31cb31e0 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -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); -- cgit v1.2.3