]> granicus.if.org Git - llvm/commitdiff
[SCEV] Simplify BackedgeTakenInfo::getMax; NFC
authorSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 26 Sep 2016 01:10:22 +0000 (01:10 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Mon, 26 Sep 2016 01:10:22 +0000 (01:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282372 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index d6ea15f3957ea6b26cd567c7f411a19acb58dbaa..746487dcde1b67c562ab2fada449475b287e8024 100644 (file)
@@ -5640,14 +5640,14 @@ ScalarEvolution::BackedgeTakenInfo::getExact(BasicBlock *ExitingBlock,
 /// getMax - Get the max backedge taken count for the loop.
 const SCEV *
 ScalarEvolution::BackedgeTakenInfo::getMax(ScalarEvolution *SE) const {
-  // TODO: use any_of
-  for (auto &ENT : ExitNotTaken)
-    if (!ENT.hasAlwaysTruePredicate())
-      return SE->getCouldNotCompute();
+  auto PredicateNotAlwaysTrue = [](const ExitNotTakenInfo &ENT) {
+    return !ENT.hasAlwaysTruePredicate();
+  };
 
-  if (auto *Max = getMax())
-    return Max;
-  return SE->getCouldNotCompute();
+  if (any_of(ExitNotTaken, PredicateNotAlwaysTrue) || !getMax())
+    return SE->getCouldNotCompute();
+
+  return getMax();
 }
 
 bool ScalarEvolution::BackedgeTakenInfo::hasOperand(const SCEV *S,