[llvm-commits] [llvm] r52251 - /llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Wojciech Matyjewicz wmatyjewicz at fastmail.fm
Fri Jun 13 10:02:03 PDT 2008


Author: wmat
Date: Fri Jun 13 12:02:03 2008
New Revision: 52251

URL: http://llvm.org/viewvc/llvm-project?rev=52251&view=rev
Log:
Use recently added getTruncateOrZeroExtend method to make the code shorter.

Modified:
    llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=52251&r1=52250&r2=52251&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Fri Jun 13 12:02:03 2008
@@ -522,11 +522,7 @@
   DOUT << "INDVARS: New CanIV: " << *IndVar;
 
   if (!isa<SCEVCouldNotCompute>(IterationCount)) {
-    if (IterationCount->getType()->getPrimitiveSizeInBits() <
-        LargestType->getPrimitiveSizeInBits())
-      IterationCount = SE->getZeroExtendExpr(IterationCount, LargestType);
-    else if (IterationCount->getType() != LargestType)
-      IterationCount = SE->getTruncateExpr(IterationCount, LargestType);
+    IterationCount = SE->getTruncateOrZeroExtend(IterationCount, LargestType);
     if (Instruction *DI = LinearFunctionTestReplace(L, IterationCount,Rewriter))
       DeadInsts.insert(DI);
   }





More information about the llvm-commits mailing list