[llvm] r282372 - [SCEV] Simplify BackedgeTakenInfo::getMax; NFC
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 25 18:10:22 PDT 2016
Author: sanjoy
Date: Sun Sep 25 20:10:22 2016
New Revision: 282372
URL: http://llvm.org/viewvc/llvm-project?rev=282372&view=rev
Log:
[SCEV] Simplify BackedgeTakenInfo::getMax; NFC
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=282372&r1=282371&r2=282372&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sun Sep 25 20:10:22 2016
@@ -5640,14 +5640,14 @@ ScalarEvolution::BackedgeTakenInfo::getE
/// 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,
More information about the llvm-commits
mailing list