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

Nick Lewycky nicholas at mxc.ca
Tue Nov 20 00:44:50 PST 2007


Author: nicholas
Date: Tue Nov 20 02:44:50 2007
New Revision: 44249

URL: http://llvm.org/viewvc/llvm-project?rev=44249&view=rev
Log:
Small cleanup. Use APInt::getHighBitsSet method instead of shift left.
"setcc" -> "icmp op" in comments. 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=44249&r1=44248&r2=44249&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Nov 20 02:44:50 2007
@@ -1207,7 +1207,7 @@
     SCEVHandle ComputeIterationCount(const Loop *L);
 
     /// ComputeLoadConstantCompareIterationCount - Given an exit condition of
-    /// 'setcc load X, cst', try to see if we can compute the trip count.
+    /// 'icmp op load X, cst', try to see if we can compute the trip count.
     SCEVHandle ComputeLoadConstantCompareIterationCount(LoadInst *LI,
                                                         Constant *RHS,
                                                         const Loop *L,
@@ -1418,13 +1418,12 @@
     if (!V.isMinValue())
       return V;
     else   // Zero is a multiple of everything.
-      return APInt(C->getBitWidth(), 1).shl(C->getBitWidth()-1);
+      return APInt::getHighBitsSet(C->getBitWidth(), 1);
   }
 
-  if (SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(S)) {
+  if (SCEVTruncateExpr *T = dyn_cast<SCEVTruncateExpr>(S))
     return GetConstantFactor(T->getOperand()).trunc(
                                cast<IntegerType>(T->getType())->getBitWidth());
-  }
   if (SCEVZeroExtendExpr *E = dyn_cast<SCEVZeroExtendExpr>(S))
     return GetConstantFactor(E->getOperand()).zext(
                                cast<IntegerType>(E->getType())->getBitWidth());
@@ -1787,7 +1786,7 @@
 }
 
 /// ComputeLoadConstantCompareIterationCount - Given an exit condition of
-/// 'setcc load X, cst', try to se if we can compute the trip count.
+/// 'icmp op load X, cst', try to se if we can compute the trip count.
 SCEVHandle ScalarEvolutionsImpl::
 ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS,
                                          const Loop *L, 





More information about the llvm-commits mailing list