Get rid of the Pass+Context magic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp
index d7ca313..8f61d88 100644
--- a/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/lib/Transforms/Utils/LowerAllocations.cpp
@@ -87,13 +87,10 @@
 // This function is always successful.
 //
 bool LowerAllocations::doInitialization(Module &M) {
-  // Ensure context initialization.
-  BasicBlockPass::doInitialization(M);
-
-  const Type *BPTy = Context->getPointerTypeUnqual(Type::Int8Ty);
+  const Type *BPTy = M.getContext().getPointerTypeUnqual(Type::Int8Ty);
   // Prototype malloc as "char* malloc(...)", because we don't know in
   // doInitialization whether size_t is int or long.
-  FunctionType *FT = Context->getFunctionType(BPTy, true);
+  FunctionType *FT = M.getContext().getFunctionType(BPTy, true);
   MallocFunc = M.getOrInsertFunction("malloc", FT);
   FreeFunc = M.getOrInsertFunction("free"  , Type::VoidTy, BPTy, (Type *)0);
   return true;
@@ -106,6 +103,8 @@
   bool Changed = false;
   assert(MallocFunc && FreeFunc && "Pass not initialized!");
 
+  LLVMContext &Context = BB.getContext();
+
   BasicBlock::InstListType &BBIL = BB.getInstList();
 
   const TargetData &TD = getAnalysis<TargetData>();
@@ -119,12 +118,12 @@
       // malloc(type) becomes i8 *malloc(size)
       Value *MallocArg;
       if (LowerMallocArgToInteger)
-        MallocArg = Context->getConstantInt(Type::Int64Ty,
+        MallocArg = Context.getConstantInt(Type::Int64Ty,
                                      TD.getTypeAllocSize(AllocTy));
       else
-        MallocArg = Context->getConstantExprSizeOf(AllocTy);
+        MallocArg = Context.getConstantExprSizeOf(AllocTy);
       MallocArg =
-           Context->getConstantExprTruncOrBitCast(cast<Constant>(MallocArg), 
+           Context.getConstantExprTruncOrBitCast(cast<Constant>(MallocArg), 
                                                   IntPtrTy);
 
       if (MI->isArrayAllocation()) {
@@ -133,8 +132,8 @@
           MallocArg = MI->getOperand(0);         // Operand * 1 = Operand
         } else if (Constant *CO = dyn_cast<Constant>(MI->getOperand(0))) {
           CO =
-              Context->getConstantExprIntegerCast(CO, IntPtrTy, false /*ZExt*/);
-          MallocArg = Context->getConstantExprMul(CO, 
+              Context.getConstantExprIntegerCast(CO, IntPtrTy, false /*ZExt*/);
+          MallocArg = Context.getConstantExprMul(CO, 
                                                   cast<Constant>(MallocArg));
         } else {
           Value *Scale = MI->getOperand(0);
@@ -157,7 +156,7 @@
       if (MCall->getType() != Type::VoidTy)
         MCast = new BitCastInst(MCall, MI->getType(), "", I);
       else
-        MCast = Context->getNullValue(MI->getType());
+        MCast = Context.getNullValue(MI->getType());
 
       // Replace all uses of the old malloc inst with the cast inst
       MI->replaceAllUsesWith(MCast);
@@ -167,7 +166,7 @@
     } else if (FreeInst *FI = dyn_cast<FreeInst>(I)) {
       Value *PtrCast = 
         new BitCastInst(FI->getOperand(0),
-                        Context->getPointerTypeUnqual(Type::Int8Ty), "", I);
+                        Context.getPointerTypeUnqual(Type::Int8Ty), "", I);
 
       // Insert a call to the free function...
       CallInst::Create(FreeFunc, PtrCast, "", I)->setTailCall();