[llvm-commits] CVS: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Zhou Sheng zhousheng00 at gmail.com
Wed Jun 27 02:50:48 PDT 2007



Changes in directory llvm/lib/Transforms/Scalar:

IndVarSimplify.cpp updated: 1.123 -> 1.124
---
Log message:

Fix a bug.


---
Diffs of the changes:  (+4 -1)

 IndVarSimplify.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.123 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.124
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.123	Tue Jun 19 09:28:31 2007
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp	Wed Jun 27 04:50:26 2007
@@ -519,8 +519,11 @@
   DOUT << "INDVARS: New CanIV: " << *IndVar;
 
   if (!isa<SCEVCouldNotCompute>(IterationCount)) {
-    if (IterationCount->getType() != LargestType)
+    if (IterationCount->getType()->getPrimitiveSizeInBits() <
+        LargestType->getPrimitiveSizeInBits())
       IterationCount = SCEVZeroExtendExpr::get(IterationCount, LargestType);
+    else if (IterationCount->getType() != LargestType)
+      IterationCount = SCEVTruncateExpr::get(IterationCount, LargestType);
     if (Instruction *DI = LinearFunctionTestReplace(L, IterationCount,Rewriter))
       DeadInsts.insert(DI);
   }






More information about the llvm-commits mailing list