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

Reid Spencer reid at x10sys.com
Tue Dec 5 11:14:31 PST 2006



Changes in directory llvm/lib/Analysis:

ScalarEvolution.cpp updated: 1.63 -> 1.64
---
Log message:

Bail on the getInferredCast idea. Remove the function and convert 
remaining uses to more specific casts.


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

 ScalarEvolution.cpp |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)


Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.63 llvm/lib/Analysis/ScalarEvolution.cpp:1.64
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.63	Mon Dec  4 15:33:23 2006
+++ llvm/lib/Analysis/ScalarEvolution.cpp	Tue Dec  5 13:14:13 2006
@@ -179,7 +179,7 @@
   if (V->getType()->isSigned()) {
     const Type *NewTy = V->getType()->getUnsignedVersion();
     V = cast<ConstantInt>(
-        ConstantExpr::getInferredCast(V, false, NewTy, false));
+        ConstantExpr::getBitCast(V, NewTy));
   }
 
   SCEVConstant *&R = (*SCEVConstants)[V];
@@ -466,7 +466,7 @@
     C = ConstantInt::get(Ty, Val);
   else {
     C = ConstantInt::get(Ty->getSignedVersion(), Val);
-    C = ConstantExpr::getInferredCast(C, true, Ty, false);
+    C = ConstantExpr::getBitCast(C, Ty);
   }
   return SCEVUnknown::get(C);
 }
@@ -513,7 +513,7 @@
       Result *= Val-(NumSteps-1);
     Constant *Res = ConstantInt::get(Type::ULongTy, Result);
     return SCEVUnknown::get(
-        ConstantExpr::getInferredCast(Res, false, V->getType(), true));
+        ConstantExpr::getTruncOrBitCast(Res, V->getType()));
   }
 
   const Type *Ty = V->getType();
@@ -559,7 +559,8 @@
 
 SCEVHandle SCEVTruncateExpr::get(const SCEVHandle &Op, const Type *Ty) {
   if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
-    return SCEVUnknown::get(ConstantExpr::getCast(SC->getValue(), Ty));
+    return SCEVUnknown::get(
+        ConstantExpr::getTruncOrBitCast(SC->getValue(), Ty));
 
   // If the input value is a chrec scev made out of constants, truncate
   // all of the constants.
@@ -582,7 +583,8 @@
 
 SCEVHandle SCEVZeroExtendExpr::get(const SCEVHandle &Op, const Type *Ty) {
   if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
-    return SCEVUnknown::get(ConstantExpr::getCast(SC->getValue(), Ty));
+    return SCEVUnknown::get(
+        ConstantExpr::getZExtOrBitCast(SC->getValue(), Ty));
 
   // FIXME: If the input value is a chrec scev, and we can prove that the value
   // did not overflow the old, smaller, value, we can zero extend all of the
@@ -998,11 +1000,10 @@
       Constant *LHSCV = LHSC->getValue();
       Constant *RHSCV = RHSC->getValue();
       if (LHSCV->getType()->isUnsigned())
-        LHSCV = ConstantExpr::getInferredCast(
-            LHSCV, false, LHSCV->getType()->getSignedVersion(), true);
+        LHSCV = ConstantExpr::getBitCast(LHSCV, 
+                                         LHSCV->getType()->getSignedVersion());
       if (RHSCV->getType()->isUnsigned())
-        RHSCV = ConstantExpr::getInferredCast(
-            RHSCV, false, LHSCV->getType(), true);
+        RHSCV = ConstantExpr::getBitCast(RHSCV, LHSCV->getType());
       return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
     }
   }






More information about the llvm-commits mailing list