[llvm-commits] [llvm] r61600 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Nick Lewycky nicholas at mxc.ca
Fri Jan 2 17:53:25 PST 2009


Author: nicholas
Date: Fri Jan  2 19:53:24 2009
New Revision: 61600

URL: http://llvm.org/viewvc/llvm-project?rev=61600&view=rev
Log:
We know it's always a SCEVConstant if it gets here, so just cast it and
inline the only use of isNegative. Fixes warning reported by Mike Stump.

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=61600&r1=61599&r2=61600&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Jan  2 19:53:24 2009
@@ -2905,11 +2905,6 @@
   return false;
 }
 
-static bool isNegative(SCEVHandle X) {
-  if (SCEVConstant *C = dyn_cast<SCEVConstant>(X))
-    return C->getValue()->getValue().isNegative();
-}
-
 /// potentialInfiniteLoop - Test whether the loop might jump over the exit value
 /// due to wrapping around 2^n.
 bool ScalarEvolutionsImpl::potentialInfiniteLoop(SCEV *Stride, SCEV *RHS,
@@ -2967,7 +2962,8 @@
     // the stride is negative, we're not counting how many times 'less-than' is
     // true as we approach it, we're counting how far away we are from wrapping
     // around the backside.
-    if (isSigned && isNegative(Stride))
+    if (isSigned &&
+        cast<SCEVConstant>(Stride)->getValue()->getValue().isNegative())
       return UnknownValue;
 
     // We know the LHS is of the form {n,+,s} and the RHS is some loop-invariant





More information about the llvm-commits mailing list