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

Nick Lewycky nicholas at mxc.ca
Sat Dec 6 09:57:06 PST 2008


Author: nicholas
Date: Sat Dec  6 11:57:05 2008
New Revision: 60623

URL: http://llvm.org/viewvc/llvm-project?rev=60623&view=rev
Log:
Minor cleanup. Use dyn_cast, not isa/cast pairs. No functionality change.

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=60623&r1=60622&r2=60623&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat Dec  6 11:57:05 2008
@@ -2911,18 +2911,18 @@
                                                  bool isSigned, bool trueWhenEqual) {
   // Return true when the distance from RHS to maxint > Stride.
 
-  if (!isa<SCEVConstant>(Stride))
+  SCEVConstant *SC = dyn_cast<SCEVConstant>(Stride);
+  if (!SC)
     return true;
-  SCEVConstant *SC = cast<SCEVConstant>(Stride);
 
   if (SC->getValue()->isZero())
     return true;
   if (!trueWhenEqual && SC->getValue()->isOne())
     return false;
 
-  if (!isa<SCEVConstant>(RHS))
+  SCEVConstant *R = dyn_cast<SCEVConstant>(RHS);
+  if (!R)
     return true;
-  SCEVConstant *R = cast<SCEVConstant>(RHS);
 
   if (isSigned)
     return true;  // XXX: because we don't have an sdiv scev.
@@ -2983,7 +2983,7 @@
     // loop by one iteration.
     //
     // The loop won't actually run (m-n)/s times because the loop iterations
-    // won't divide evenly. For example, if you have {2,+,5} u< 10 the
+    // might not divide cleanly. For example, if you have {2,+,5} u< 10 the
     // division would equal one, but the loop runs twice putting the
     // induction variable at 12.
 





More information about the llvm-commits mailing list