Push LLVMContexts through the IntegerType APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78948 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index 224a136..1c8badc 100644
--- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -38,15 +38,15 @@
 /// byte store (e.g. i16 0x1234), return null.
 static Value *isBytewiseValue(Value *V, LLVMContext& Context) {
   // All byte-wide stores are splatable, even of arbitrary variables.
-  if (V->getType() == Type::Int8Ty) return V;
+  if (V->getType() == Type::getInt8Ty(Context)) return V;
   
   // Constant float and double values can be handled as integer values if the
   // corresponding integer value is "byteable".  An important case is 0.0. 
   if (ConstantFP *CFP = dyn_cast<ConstantFP>(V)) {
-    if (CFP->getType() == Type::FloatTy)
-      V = ConstantExpr::getBitCast(CFP, Type::Int32Ty);
-    if (CFP->getType() == Type::DoubleTy)
-      V = ConstantExpr::getBitCast(CFP, Type::Int64Ty);
+    if (CFP->getType() == Type::getFloatTy(Context))
+      V = ConstantExpr::getBitCast(CFP, Type::getInt32Ty(Context));
+    if (CFP->getType() == Type::getDoubleTy(Context))
+      V = ConstantExpr::getBitCast(CFP, Type::getInt64Ty(Context));
     // Don't handle long double formats, which have strange constraints.
   }
   
@@ -431,7 +431,7 @@
     BasicBlock::iterator InsertPt = BI;
   
     if (MemSetF == 0) {
-      const Type *Tys[] = {Type::Int64Ty};
+      const Type *Tys[] = {Type::getInt64Ty(SI->getContext())};
       MemSetF = Intrinsic::getDeclaration(M, Intrinsic::memset,
                                           Tys, 1);
    }
@@ -440,7 +440,8 @@
     StartPtr = Range.StartPtr;
   
     // Cast the start ptr to be i8* as memset requires.
-    const Type *i8Ptr = PointerType::getUnqual(Type::Int8Ty);
+    const Type *i8Ptr =
+          PointerType::getUnqual(Type::getInt8Ty(SI->getContext()));
     if (StartPtr->getType() != i8Ptr)
       StartPtr = new BitCastInst(StartPtr, i8Ptr, StartPtr->getName(),
                                  InsertPt);
@@ -448,9 +449,10 @@
     Value *Ops[] = {
       StartPtr, ByteVal,   // Start, value
       // size
-      ConstantInt::get(Type::Int64Ty, Range.End-Range.Start),
+      ConstantInt::get(Type::getInt64Ty(SI->getContext()),
+                       Range.End-Range.Start),
       // align
-      ConstantInt::get(Type::Int32Ty, Range.Alignment)
+      ConstantInt::get(Type::getInt32Ty(SI->getContext()), Range.Alignment)
     };
     Value *C = CallInst::Create(MemSetF, Ops, Ops+4, "", InsertPt);
     DEBUG(cerr << "Replace stores:\n";