X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTransforms%2FScalar%2FScalarReplAggregates.cpp;h=51aad84c0725ab970eae08fdbec7b01abdc7f3e1;hb=051a950000e21935165db56695e35bade668193b;hp=2977afa17924dafd9b348a3eabd78b9f19aaeba3;hpb=d963ab1f58adb6daa028533ff3285841d7e45f80;p=oota-llvm.git diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 2977afa1792..51aad84c072 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -323,8 +323,8 @@ void SROA::DoScalarReplacement(AllocationInst *AI, SmallVector NewArgs; NewArgs.push_back(Constant::getNullValue(Type::Int32Ty)); NewArgs.append(GEPI->op_begin()+3, GEPI->op_end()); - RepValue = new GetElementPtrInst(AllocaToUse, NewArgs.begin(), - NewArgs.end(), "", GEPI); + RepValue = GetElementPtrInst::Create(AllocaToUse, NewArgs.begin(), + NewArgs.end(), "", GEPI); RepValue->takeName(GEPI); } @@ -634,9 +634,9 @@ void SROA::RewriteBitCastUserOfAlloca(Instruction *BCInst, AllocationInst *AI, Value *Idx[2]; Idx[0] = Zero; Idx[1] = ConstantInt::get(Type::Int32Ty, i); - OtherElt = new GetElementPtrInst(OtherPtr, Idx, Idx + 2, - OtherPtr->getNameStr()+"."+utostr(i), - MI); + OtherElt = GetElementPtrInst::Create(OtherPtr, Idx, Idx + 2, + OtherPtr->getNameStr()+"."+utostr(i), + MI); } Value *EltPtr = NewElts[i]; @@ -716,7 +716,7 @@ void SROA::RewriteBitCastUserOfAlloca(Instruction *BCInst, AllocationInst *AI, ConstantInt::get(MI->getOperand(3)->getType(), EltSize), // Size Zero // Align }; - new CallInst(TheFn, Ops, Ops + 4, "", MI); + CallInst::Create(TheFn, Ops, Ops + 4, "", MI); } else { assert(isa(MI)); Value *Ops[] = { @@ -724,7 +724,7 @@ void SROA::RewriteBitCastUserOfAlloca(Instruction *BCInst, AllocationInst *AI, ConstantInt::get(MI->getOperand(3)->getType(), EltSize), // Size Zero // Align }; - new CallInst(TheFn, Ops, Ops + 4, "", MI); + CallInst::Create(TheFn, Ops, Ops + 4, "", MI); } } @@ -838,22 +838,22 @@ void SROA::CanonicalizeAllocaUsers(AllocationInst *AI) { // Insert the new GEP instructions, which are properly indexed. SmallVector Indices(GEPI->op_begin()+1, GEPI->op_end()); Indices[1] = Constant::getNullValue(Type::Int32Ty); - Value *ZeroIdx = new GetElementPtrInst(GEPI->getOperand(0), - Indices.begin(), - Indices.end(), - GEPI->getName()+".0", GEPI); + Value *ZeroIdx = GetElementPtrInst::Create(GEPI->getOperand(0), + Indices.begin(), + Indices.end(), + GEPI->getName()+".0", GEPI); Indices[1] = ConstantInt::get(Type::Int32Ty, 1); - Value *OneIdx = new GetElementPtrInst(GEPI->getOperand(0), - Indices.begin(), - Indices.end(), - GEPI->getName()+".1", GEPI); + Value *OneIdx = GetElementPtrInst::Create(GEPI->getOperand(0), + Indices.begin(), + Indices.end(), + GEPI->getName()+".1", GEPI); // Replace all loads of the variable index GEP with loads from both // indexes and a select. while (!GEPI->use_empty()) { LoadInst *LI = cast(GEPI->use_back()); Value *Zero = new LoadInst(ZeroIdx, LI->getName()+".0", LI); Value *One = new LoadInst(OneIdx , LI->getName()+".1", LI); - Value *R = new SelectInst(IsOne, One, Zero, LI->getName(), LI); + Value *R = SelectInst::Create(IsOne, One, Zero, LI->getName(), LI); LI->replaceAllUsesWith(R); LI->eraseFromParent(); } @@ -1261,9 +1261,9 @@ Value *SROA::ConvertUsesOfStoreToScalar(StoreInst *SI, AllocaInst *NewAI, // Must be an element insertion. const TargetData &TD = getAnalysis(); unsigned Elt = Offset/TD.getABITypeSizeInBits(PTy->getElementType()); - SV = new InsertElementInst(Old, SV, - ConstantInt::get(Type::Int32Ty, Elt), - "tmp", SI); + SV = InsertElementInst::Create(Old, SV, + ConstantInt::get(Type::Int32Ty, Elt), + "tmp", SI); } } else if (isa(AllocaType)) { // If the alloca type is a pointer, then all the elements must be