Use recently added getTruncateOrZeroExtend method to make the code shorter.
authorWojciech Matyjewicz <wmatyjewicz@fastmail.fm>
Fri, 13 Jun 2008 17:02:03 +0000 (17:02 +0000)
committerWojciech Matyjewicz <wmatyjewicz@fastmail.fm>
Fri, 13 Jun 2008 17:02:03 +0000 (17:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52251 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/IndVarSimplify.cpp

index f529281be1bbca1c3b9cb004507f135aae92bd5c..3368f2acd717b0067b23459987ec1815ca9343a6 100644 (file)
@@ -522,11 +522,7 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
   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);
   }