Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32514 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 46b8f26..7d73d7d 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -584,7 +584,7 @@
 SCEVHandle SCEVZeroExtendExpr::get(const SCEVHandle &Op, const Type *Ty) {
   if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
     return SCEVUnknown::get(
-        ConstantExpr::getZeroExtend(SC->getValue(), Ty));
+        ConstantExpr::getZExt(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
@@ -2000,11 +2000,14 @@
           } else {
             SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L);
             if (SCEVConstant *SC = dyn_cast<SCEVConstant>(OpV))
-              Operands.push_back(ConstantExpr::getCast(SC->getValue(),
-                                                       Op->getType()));
+              Operands.push_back(ConstantExpr::getIntegerCast(SC->getValue(), 
+                                                              Op->getType(), 
+                                                              false));
             else if (SCEVUnknown *SU = dyn_cast<SCEVUnknown>(OpV)) {
               if (Constant *C = dyn_cast<Constant>(SU->getValue()))
-                Operands.push_back(ConstantExpr::getCast(C, Op->getType()));
+                Operands.push_back(ConstantExpr::getIntegerCast(C, 
+                                                                Op->getType(), 
+                                                                false));
               else
                 return V;
             } else {
@@ -2122,7 +2125,7 @@
 
   // Compute floor(sqrt(B^2-4ac))
   ConstantInt *SqrtVal =
-    cast<ConstantInt>(ConstantExpr::getCast(SqrtTerm,
+    cast<ConstantInt>(ConstantExpr::getBitCast(SqrtTerm,
                                    SqrtTerm->getType()->getUnsignedVersion()));
   uint64_t SqrtValV = SqrtVal->getZExtValue();
   uint64_t SqrtValV2 = (uint64_t)sqrt((double)SqrtValV);
@@ -2135,16 +2138,16 @@
   }
 
   SqrtVal = ConstantInt::get(Type::ULongTy, SqrtValV2);
-  SqrtTerm = ConstantExpr::getCast(SqrtVal, SqrtTerm->getType());
+  SqrtTerm = ConstantExpr::getTruncOrBitCast(SqrtVal, SqrtTerm->getType());
 
   Constant *NegB = ConstantExpr::getNeg(B);
   Constant *TwoA = ConstantExpr::getMul(A, Two);
 
   // The divisions must be performed as signed divisions.
   const Type *SignedTy = NegB->getType()->getSignedVersion();
-  NegB = ConstantExpr::getCast(NegB, SignedTy);
-  TwoA = ConstantExpr::getCast(TwoA, SignedTy);
-  SqrtTerm = ConstantExpr::getCast(SqrtTerm, SignedTy);
+  NegB = ConstantExpr::getBitCast(NegB, SignedTy);
+  TwoA = ConstantExpr::getBitCast(TwoA, SignedTy);
+  SqrtTerm = ConstantExpr::getBitCast(SqrtTerm, SignedTy);
 
   Constant *Solution1 =
     ConstantExpr::getSDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA);