[llvm] r331022 - [SCEV] Add trivial case handling for umin utilities. NFC.

Serguei Katkov via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 01:02:51 PDT 2018


Author: skatkov
Date: Fri Apr 27 01:02:50 2018
New Revision: 331022

URL: http://llvm.org/viewvc/llvm-project?rev=331022&view=rev
Log:
[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

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=331022&r1=331021&r2=331022&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Apr 27 01:02:50 2018
@@ -3567,6 +3567,11 @@ const SCEV *ScalarEvolution::getUMinExpr
 }
 
 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::getUMinFrom
 
 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::getE
            "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.




More information about the llvm-commits mailing list