summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2018-04-27 08:02:50 +0000
committerSerguei Katkov <serguei.katkov@azul.com>2018-04-27 08:02:50 +0000
commit1956a48d273dca31d379b3b032bf772040d3c93d (patch)
treece76277eec57e5c8331aa1caf3ebf483c8758dec /llvm/lib/Analysis/ScalarEvolution.cpp
parent0d24edab022101146f1b40e980ef36dd0a0bcc34 (diff)
downloadbcm5719-llvm-1956a48d273dca31d379b3b032bf772040d3c93d.tar.gz
bcm5719-llvm-1956a48d273dca31d379b3b032bf772040d3c93d.zip
[SCEV] Add trivial case handling for umin utilities. NFC.
Reviewers: sanjoy, mkazantsev Reviewed By: mkazantsev Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D46175 llvm-svn: 331022
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index f1ea3a8c546..ab21cd150f8 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -3567,6 +3567,11 @@ const SCEV *ScalarEvolution::getUMinExpr(const SCEV *LHS,
}
const SCEV *ScalarEvolution::getUMinExpr(SmallVectorImpl<const SCEV *> &Ops) {
+ assert(!Ops.empty() && "At least one operand must be!");
+ // Trivial case.
+ if (Ops.size() == 1)
+ return Ops[0];
+
// ~umax(~x, ~y, ~z) == umin(x, y, z).
SmallVector<const SCEV *, 2> NotOps;
for (auto *S : Ops)
@@ -3965,6 +3970,11 @@ const SCEV *ScalarEvolution::getUMinFromMismatchedTypes(const SCEV *LHS,
const SCEV *ScalarEvolution::getUMinFromMismatchedTypes(
SmallVectorImpl<const SCEV *> &Ops) {
+ assert(!Ops.empty() && "At least one operand must be!");
+ // Trivial case.
+ if (Ops.size() == 1)
+ return Ops[0];
+
// Find the max type first.
Type *MaxType = nullptr;
for (auto *S : Ops)
@@ -6718,8 +6728,7 @@ ScalarEvolution::BackedgeTakenInfo::getExact(const Loop *L, ScalarEvolution *SE,
"Predicate should be always true!");
}
- assert(!Ops.empty() && "Loop without exits");
- return Ops.size() == 1 ? Ops[0] : SE->getUMinFromMismatchedTypes(Ops);
+ return SE->getUMinFromMismatchedTypes(Ops);
}
/// Get the exact not taken count for this loop exit.
OpenPOWER on IntegriCloud