diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-15 23:53:25 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-15 23:53:25 +0000 |
commit | 140166dfcd14dc05ebca646f41d1dfe155718182 (patch) | |
tree | 2e30bfd47153b472b2e2ff73a2fb3b594ca56f46 /lib/Transforms/IPO | |
parent | f87b6fe74ebcdd70263889c697960ee7525e9b79 (diff) | |
download | external_llvm-140166dfcd14dc05ebca646f41d1dfe155718182.zip external_llvm-140166dfcd14dc05ebca646f41d1dfe155718182.tar.gz external_llvm-140166dfcd14dc05ebca646f41d1dfe155718182.tar.bz2 |
Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75863 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r-- | lib/Transforms/IPO/ArgumentPromotion.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 9 | ||||
-rw-r--r-- | lib/Transforms/IPO/IndMemRemoval.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/IPO/LowerSetJmp.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/IPO/RaiseAllocations.cpp | 3 | ||||
-rw-r--r-- | lib/Transforms/IPO/StructRetPromotion.cpp | 4 |
6 files changed, 11 insertions, 13 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp index 7f1c3cb..75a0415 100644 --- a/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -755,7 +755,7 @@ Function *ArgPromotion::DoPromotion(Function *F, // Just add all the struct element types. const Type *AgTy = cast<PointerType>(I->getType())->getElementType(); - Value *TheAlloca = new AllocaInst(*Context, AgTy, 0, "", InsertPt); + Value *TheAlloca = new AllocaInst(AgTy, 0, "", InsertPt); const StructType *STy = cast<StructType>(AgTy); Value *Idxs[2] = { Context->getConstantInt(Type::Int32Ty, 0), 0 }; diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 13fe94a..398f78a 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -828,7 +828,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV, Type *NewTy = Context->getArrayType(MI->getAllocatedType(), NElements->getZExtValue()); MallocInst *NewMI = - new MallocInst(*Context, NewTy, Context->getNullValue(Type::Int32Ty), + new MallocInst(NewTy, Context->getNullValue(Type::Int32Ty), MI->getAlignment(), MI->getName(), MI); Value* Indices[2]; Indices[0] = Indices[1] = Context->getNullValue(Type::Int32Ty); @@ -1291,7 +1291,7 @@ static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, MallocInst *MI, GV->isThreadLocal()); FieldGlobals.push_back(NGV); - MallocInst *NMI = new MallocInst(*Context, FieldTy, MI->getArraySize(), + MallocInst *NMI = new MallocInst(FieldTy, MI->getArraySize(), MI->getName() + ".f" + utostr(FieldNo),MI); FieldMallocs.push_back(NMI); new StoreInst(NMI, NGV, MI); @@ -1507,7 +1507,7 @@ static bool TryToOptimizeStoreOfMallocToGlobal(GlobalVariable *GV, // structs. malloc [100 x struct],1 -> malloc struct, 100 if (const ArrayType *AT = dyn_cast<ArrayType>(MI->getAllocatedType())) { MallocInst *NewMI = - new MallocInst(*Context, AllocSTy, + new MallocInst(AllocSTy, Context->getConstantInt(Type::Int32Ty, AT->getNumElements()), "", MI); NewMI->takeName(MI); @@ -1703,8 +1703,7 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV, Instruction* FirstI = GS.AccessingFunction->getEntryBlock().begin(); const Type* ElemTy = GV->getType()->getElementType(); // FIXME: Pass Global's alignment when globals have alignment - AllocaInst* Alloca = new AllocaInst(*Context, ElemTy, NULL, - GV->getName(), FirstI); + AllocaInst* Alloca = new AllocaInst(ElemTy, NULL, GV->getName(), FirstI); if (!isa<UndefValue>(GV->getInitializer())) new StoreInst(GV->getInitializer(), Alloca, FirstI); diff --git a/lib/Transforms/IPO/IndMemRemoval.cpp b/lib/Transforms/IPO/IndMemRemoval.cpp index d3e609d..2086a16 100644 --- a/lib/Transforms/IPO/IndMemRemoval.cpp +++ b/lib/Transforms/IPO/IndMemRemoval.cpp @@ -73,7 +73,7 @@ bool IndMemRemPass::runOnModule(Module &M) { BasicBlock* bb = BasicBlock::Create("entry",FN); Instruction* c = CastInst::CreateIntegerCast( FN->arg_begin(), Type::Int32Ty, false, "c", bb); - Instruction* a = new MallocInst(*Context, Type::Int8Ty, c, "m", bb); + Instruction* a = new MallocInst(Type::Int8Ty, c, "m", bb); ReturnInst::Create(a, bb); ++NumBounce; NumBounceSites += F->getNumUses(); diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp index 8f5d50d..dfdf5b6 100644 --- a/lib/Transforms/IPO/LowerSetJmp.cpp +++ b/lib/Transforms/IPO/LowerSetJmp.cpp @@ -311,7 +311,7 @@ AllocaInst* LowerSetJmp::GetSetJmpMap(Function* Func) // Fill in the alloca and call to initialize the SJ map. const Type *SBPTy = Context->getPointerTypeUnqual(Type::Int8Ty); - AllocaInst* Map = new AllocaInst(*Context, SBPTy, 0, "SJMap", Inst); + AllocaInst* Map = new AllocaInst(SBPTy, 0, "SJMap", Inst); CallInst::Create(InitSJMap, Map, "", Inst); return SJMap[Func] = Map; } @@ -408,7 +408,7 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst) UI != E; ++UI) if (cast<Instruction>(*UI)->getParent() != ABlock || InstrsAfterCall.count(cast<Instruction>(*UI))) { - DemoteRegToStack(*Context, *II); + DemoteRegToStack(*II); break; } InstrsAfterCall.clear(); diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp index ce976c8..6c32050 100644 --- a/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/lib/Transforms/IPO/RaiseAllocations.cpp @@ -169,8 +169,7 @@ bool RaiseAllocations::runOnModule(Module &M) { CastInst::CreateIntegerCast(Source, Type::Int32Ty, false/*ZExt*/, "MallocAmtCast", I); - MallocInst *MI = new MallocInst(*Context, Type::Int8Ty, - Source, "", I); + MallocInst *MI = new MallocInst(Type::Int8Ty, Source, "", I); MI->takeName(I); I->replaceAllUsesWith(MI); diff --git a/lib/Transforms/IPO/StructRetPromotion.cpp b/lib/Transforms/IPO/StructRetPromotion.cpp index 7771bc4..933bbb0 100644 --- a/lib/Transforms/IPO/StructRetPromotion.cpp +++ b/lib/Transforms/IPO/StructRetPromotion.cpp @@ -110,8 +110,8 @@ bool SRETPromotion::PromoteReturn(CallGraphNode *CGN) { DOUT << "SretPromotion: sret argument will be promoted\n"; NumSRET++; // [1] Replace use of sret parameter - AllocaInst *TheAlloca = new AllocaInst (*Context, STy, NULL, "mrv", - F->getEntryBlock().begin()); + AllocaInst *TheAlloca = new AllocaInst(STy, NULL, "mrv", + F->getEntryBlock().begin()); Value *NFirstArg = F->arg_begin(); NFirstArg->replaceAllUsesWith(TheAlloca); |