[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

Reid Spencer reid at x10sys.com
Mon Dec 11 21:05:26 PST 2006



Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.69 -> 1.70
---
Log message:

Change inferred getCast into specific getCast. Passes all tests.


---
Diffs of the changes:  (+9 -3)

 ScalarEvolution.cpp |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.69 llvm/lib/Analysis/ScalarEvolution.cpp:1.70
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.69	Mon Dec 11 20:26:09 2006
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Mon Dec 11 23:04:59 2006
@@ -1566,7 +1566,9 @@
         // comparison.
         ConstantInt *CompVal = RHSC->getValue();
         const Type *RealTy = ExitCond->getOperand(0)->getType();
-        CompVal = dyn_cast<ConstantInt>(ConstantExpr::getCast(CompVal, RealTy));
+        CompVal = dyn_cast<ConstantInt>(
+          ConstantExpr::getIntegerCast(CompVal, RealTy, 
+                                       CompVal->getType()->isSigned()));
         if (CompVal) {
           // Form the constant range.
           ConstantRange CompRange(Cond, CompVal);
@@ -1575,8 +1577,12 @@
           // range.
           if (CompRange.getLower()->getType()->isSigned()) {
             const Type *NewTy = RHSC->getValue()->getType();
-            Constant *NewL = ConstantExpr::getCast(CompRange.getLower(), NewTy);
-            Constant *NewU = ConstantExpr::getCast(CompRange.getUpper(), NewTy);
+            Constant *NewL = 
+              ConstantExpr::getIntegerCast(CompRange.getLower(), NewTy, 
+                 CompRange.getLower()->getType()->isSigned());
+            Constant *NewU = 
+              ConstantExpr::getIntegerCast(CompRange.getUpper(), NewTy,
+                 CompRange.getUpper()->getType()->isSigned());
             CompRange = ConstantRange(NewL, NewU);
           }
 






More information about the llvm-commits mailing list