Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.61 -> 1.62
---
Log message:

Fix inferred casts.


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

 ScalarEvolution.cpp |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.61 
llvm/lib/Analysis/ScalarEvolution.cpp:1.62
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.61  Fri Dec  1 20:22:01 2006
+++ llvm/lib/Analysis/ScalarEvolution.cpp       Mon Dec  4 11:05:42 2006
@@ -178,7 +178,8 @@
   // Make sure that SCEVConstant instances are all unsigned.
   if (V->getType()->isSigned()) {
     const Type *NewTy = V->getType()->getUnsignedVersion();
-    V = cast<ConstantInt>(ConstantExpr::getCast(V, NewTy));
+    V = cast<ConstantInt>(
+        ConstantExpr::getInferredCast(V, false, NewTy, false));
   }
 
   SCEVConstant *&R = (*SCEVConstants)[V];
@@ -465,7 +466,7 @@
     C = ConstantInt::get(Ty, Val);
   else {
     C = ConstantInt::get(Ty->getSignedVersion(), Val);
-    C = ConstantExpr::getCast(C, Ty);
+    C = ConstantExpr::getInferredCast(C, true, Ty, false);
   }
   return SCEVUnknown::get(C);
 }
@@ -511,7 +512,8 @@
     for (; NumSteps; --NumSteps)
       Result *= Val-(NumSteps-1);
     Constant *Res = ConstantInt::get(Type::ULongTy, Result);
-    return SCEVUnknown::get(ConstantExpr::getCast(Res, V->getType()));
+    return SCEVUnknown::get(
+        ConstantExpr::getInferredCast(Res, false, V->getType(), true));
   }
 
   const Type *Ty = V->getType();
@@ -996,10 +998,11 @@
       Constant *LHSCV = LHSC->getValue();
       Constant *RHSCV = RHSC->getValue();
       if (LHSCV->getType()->isUnsigned())
-        LHSCV = ConstantExpr::getCast(LHSCV,
-                                      LHSCV->getType()->getSignedVersion());
+        LHSCV = ConstantExpr::getInferredCast(
+            LHSCV, false, LHSCV->getType()->getSignedVersion(), true);
       if (RHSCV->getType()->isUnsigned())
-        RHSCV = ConstantExpr::getCast(RHSCV, LHSCV->getType());
+        RHSCV = ConstantExpr::getInferredCast(
+            RHSCV, false, LHSCV->getType(), true);
       return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
     }
   }



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to