[PATCH] D46175: [SCEV] Add trivial case handling for umin utilities
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 27 01:08:45 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL331022: [SCEV] Add trivial case handling for umin utilities. NFC. (authored by skatkov, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D46175?vs=144288&id=144294#toc
Repository:
rL LLVM
https://reviews.llvm.org/D46175
Files:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Index: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
===================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp
@@ -3567,6 +3567,11 @@
}
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(
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 @@
"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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46175.144294.patch
Type: text/x-patch
Size: 1196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180427/b6aa36f5/attachment.bin>
More information about the llvm-commits
mailing list