aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp6
-rw-r--r--lib/AsmParser/llvmAsmParser.y38
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp34
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp82
-rw-r--r--lib/CodeGen/ShadowStackCollector.cpp10
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp12
-rw-r--r--lib/Linker/LinkModules.cpp8
-rw-r--r--lib/Target/X86/X86TargetAsmInfo.cpp2
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp24
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp18
-rw-r--r--lib/Transforms/IPO/ExtractGV.cpp4
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp35
-rw-r--r--lib/Transforms/IPO/IndMemRemoval.cpp20
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp42
-rw-r--r--lib/Transforms/IPO/PruneEH.cpp6
-rw-r--r--lib/Transforms/IPO/RaiseAllocations.cpp4
-rw-r--r--lib/Transforms/IPO/SimplifyLibCalls.cpp82
-rw-r--r--lib/Transforms/IPO/StructRetPromotion.cpp16
-rw-r--r--lib/Transforms/Instrumentation/ProfilingUtils.cpp4
-rw-r--r--lib/Transforms/Instrumentation/RSProfiling.cpp37
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp6
-rw-r--r--lib/Transforms/Scalar/GCSE.cpp2
-rw-r--r--lib/Transforms/Scalar/GVN.cpp8
-rw-r--r--lib/Transforms/Scalar/GVNPRE.cpp32
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp10
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp108
-rw-r--r--lib/Transforms/Scalar/LoopIndexSplit.cpp26
-rw-r--r--lib/Transforms/Scalar/LoopRotation.cpp14
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp2
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp20
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp2
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp38
-rw-r--r--lib/Transforms/Scalar/SimplifyCFG.cpp6
-rw-r--r--lib/Transforms/Scalar/TailRecursionElimination.cpp12
-rw-r--r--lib/Transforms/Utils/BasicBlockUtils.cpp2
-rw-r--r--lib/Transforms/Utils/BreakCriticalEdges.cpp6
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp10
-rw-r--r--lib/Transforms/Utils/CloneModule.cpp4
-rw-r--r--lib/Transforms/Utils/CodeExtractor.cpp62
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp34
-rw-r--r--lib/Transforms/Utils/LCSSA.cpp8
-rw-r--r--lib/Transforms/Utils/Local.cpp4
-rw-r--r--lib/Transforms/Utils/LoopSimplify.cpp14
-rw-r--r--lib/Transforms/Utils/LowerAllocations.cpp4
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp64
-rw-r--r--lib/Transforms/Utils/LowerSwitch.cpp16
-rw-r--r--lib/Transforms/Utils/PromoteMemoryToRegister.cpp6
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp60
-rw-r--r--lib/Transforms/Utils/UnifyFunctionExitNodes.cpp24
-rw-r--r--lib/VMCore/AutoUpgrade.cpp15
-rw-r--r--lib/VMCore/BasicBlock.cpp10
-rw-r--r--lib/VMCore/Constants.cpp47
-rw-r--r--lib/VMCore/Core.cpp10
-rw-r--r--lib/VMCore/Function.cpp2
-rw-r--r--lib/VMCore/Instructions.cpp16
-rw-r--r--lib/VMCore/Module.cpp4
56 files changed, 621 insertions, 571 deletions
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index 0a0327d925..7ef1948b6a 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -143,7 +143,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
// Create and insert the PHI node for the induction variable in the
// specified loop.
BasicBlock *Header = L->getHeader();
- PHINode *PN = new PHINode(Ty, "indvar", Header->begin());
+ PHINode *PN = PHINode::Create(Ty, "indvar", Header->begin());
PN->addIncoming(Constant::getNullValue(Ty), L->getLoopPreheader());
pred_iterator HPI = pred_begin(Header);
@@ -215,7 +215,7 @@ Value *SCEVExpander::visitSMaxExpr(SCEVSMaxExpr *S) {
for (unsigned i = 1; i < S->getNumOperands(); ++i) {
Value *RHS = expand(S->getOperand(i));
Value *ICmp = new ICmpInst(ICmpInst::ICMP_SGT, LHS, RHS, "tmp", InsertPt);
- LHS = new SelectInst(ICmp, LHS, RHS, "smax", InsertPt);
+ LHS = SelectInst::Create(ICmp, LHS, RHS, "smax", InsertPt);
}
return LHS;
}
@@ -225,7 +225,7 @@ Value *SCEVExpander::visitUMaxExpr(SCEVUMaxExpr *S) {
for (unsigned i = 1; i < S->getNumOperands(); ++i) {
Value *RHS = expand(S->getOperand(i));
Value *ICmp = new ICmpInst(ICmpInst::ICMP_UGT, LHS, RHS, "tmp", InsertPt);
- LHS = new SelectInst(ICmp, LHS, RHS, "umax", InsertPt);
+ LHS = SelectInst::Create(ICmp, LHS, RHS, "umax", InsertPt);
}
return LHS;
}
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 6aab1fe40b..5209d21830 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -493,7 +493,7 @@ static Value *getVal(const Type *Ty, const ValID &ID) {
}
const Type* ElTy = PTy->getElementType();
if (const FunctionType *FTy = dyn_cast<FunctionType>(ElTy))
- V = new Function(FTy, GlobalValue::ExternalLinkage);
+ V = Function::Create(FTy, GlobalValue::ExternalLinkage);
else
V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
(Module*)0, false, PTy->getAddressSpace());
@@ -551,7 +551,7 @@ static BasicBlock *defineBBVal(const ValID &ID, BasicBlock *unwindDest) {
// We haven't seen this BB before and its first mention is a definition.
// Just create it and return it.
std::string Name (ID.Type == ValID::LocalName ? ID.getName() : "");
- BB = new BasicBlock(Name, CurFun.CurrentFunction);
+ BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
if (ID.Type == ValID::LocalID) {
assert(ID.Num == CurFun.NextValNum && "Invalid new block number");
InsertValue(BB);
@@ -607,7 +607,7 @@ static BasicBlock *getBBVal(const ValID &ID) {
std::string Name;
if (ID.Type == ValID::LocalName)
Name = ID.getName();
- BB = new BasicBlock(Name, CurFun.CurrentFunction);
+ BB = BasicBlock::Create(Name, CurFun.CurrentFunction);
// Insert it in the forward refs map.
CurFun.BBForwardRefs[ID] = BB;
@@ -1779,8 +1779,8 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
GlobalValue *GV;
if (const FunctionType *FTy =
dyn_cast<FunctionType>(PT->getElementType())) {
- GV = new Function(FTy, GlobalValue::ExternalWeakLinkage, Name,
- CurModule.CurrentModule);
+ GV = Function::Create(FTy, GlobalValue::ExternalWeakLinkage, Name,
+ CurModule.CurrentModule);
} else {
GV = new GlobalVariable(PT->getElementType(), false,
GlobalValue::ExternalWeakLinkage, 0,
@@ -2319,8 +2319,8 @@ FunctionHeaderH : OptCallingConv ResultTypes GlobalName '(' ArgList ')'
AI->setName("");
}
} else { // Not already defined?
- Fn = new Function(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
- CurModule.CurrentModule);
+ Fn = Function::Create(FT, GlobalValue::ExternalWeakLinkage, FunctionName,
+ CurModule.CurrentModule);
InsertValue(Fn, CurModule.Values);
}
@@ -2579,18 +2579,18 @@ BBTerminatorInst :
RET ReturnedVal { // Return with a result...
ValueList &VL = *$2;
assert(!VL.empty() && "Invalid ret operands!");
- $$ = new ReturnInst(&VL[0], VL.size());
+ $$ = ReturnInst::Create(&VL[0], VL.size());
delete $2;
CHECK_FOR_ERROR
}
| RET VOID { // Return with no result...
- $$ = new ReturnInst();
+ $$ = ReturnInst::Create();
CHECK_FOR_ERROR
}
| BR LABEL ValueRef { // Unconditional Branch...
BasicBlock* tmpBB = getBBVal($3);
CHECK_FOR_ERROR
- $$ = new BranchInst(tmpBB);
+ $$ = BranchInst::Create(tmpBB);
} // Conditional Branch...
| BR INTTYPE ValueRef ',' LABEL ValueRef ',' LABEL ValueRef {
assert(cast<IntegerType>($2)->getBitWidth() == 1 && "Not Bool?");
@@ -2600,14 +2600,14 @@ BBTerminatorInst :
CHECK_FOR_ERROR
Value* tmpVal = getVal(Type::Int1Ty, $3);
CHECK_FOR_ERROR
- $$ = new BranchInst(tmpBBA, tmpBBB, tmpVal);
+ $$ = BranchInst::Create(tmpBBA, tmpBBB, tmpVal);
}
| SWITCH IntType ValueRef ',' LABEL ValueRef '[' JumpTable ']' {
Value* tmpVal = getVal($2, $3);
CHECK_FOR_ERROR
BasicBlock* tmpBB = getBBVal($6);
CHECK_FOR_ERROR
- SwitchInst *S = new SwitchInst(tmpVal, tmpBB, $8->size());
+ SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, $8->size());
$$ = S;
std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = $8->begin(),
@@ -2626,7 +2626,7 @@ BBTerminatorInst :
CHECK_FOR_ERROR
BasicBlock* tmpBB = getBBVal($6);
CHECK_FOR_ERROR
- SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
+ SwitchInst *S = SwitchInst::Create(tmpVal, tmpBB, 0);
$$ = S;
CHECK_FOR_ERROR
}
@@ -2704,7 +2704,7 @@ BBTerminatorInst :
PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
// Create the InvokeInst
- InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(),Args.end());
+ InvokeInst *II = InvokeInst::Create(V, Normal, Except, Args.begin(),Args.end());
II->setCallingConv($2);
II->setParamAttrs(PAL);
$$ = II;
@@ -2911,7 +2911,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
GEN_ERROR("select condition must be boolean");
if ($4->getType() != $6->getType())
GEN_ERROR("select value types should match");
- $$ = new SelectInst($2, $4, $6);
+ $$ = SelectInst::Create($2, $4, $6);
CHECK_FOR_ERROR
}
| VAARG ResolvedVal ',' Types {
@@ -2930,7 +2930,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
| INSERTELEMENT ResolvedVal ',' ResolvedVal ',' ResolvedVal {
if (!InsertElementInst::isValidOperands($2, $4, $6))
GEN_ERROR("Invalid insertelement operands");
- $$ = new InsertElementInst($2, $4, $6);
+ $$ = InsertElementInst::Create($2, $4, $6);
CHECK_FOR_ERROR
}
| SHUFFLEVECTOR ResolvedVal ',' ResolvedVal ',' ResolvedVal {
@@ -2943,7 +2943,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
const Type *Ty = $2->front().first->getType();
if (!Ty->isFirstClassType())
GEN_ERROR("PHI node operands must be of first class type");
- $$ = new PHINode(Ty);
+ $$ = PHINode::Create(Ty);
((PHINode*)$$)->reserveOperandSpace($2->size());
while ($2->begin() != $2->end()) {
if ($2->front().first->getType() != Ty)
@@ -3031,7 +3031,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
PAL = PAListPtr::get(Attrs.begin(), Attrs.end());
// Create the call node
- CallInst *CI = new CallInst(V, Args.begin(), Args.end());
+ CallInst *CI = CallInst::Create(V, Args.begin(), Args.end());
CI->setTailCall($1);
CI->setCallingConv($2);
CI->setParamAttrs(PAL);
@@ -3144,7 +3144,7 @@ MemoryInst : MALLOC Types OptCAlign {
(*$2)->getDescription()+ "'");
Value* tmpVal = getVal(*$2, $3);
CHECK_FOR_ERROR
- $$ = new GetElementPtrInst(tmpVal, $4->begin(), $4->end());
+ $$ = GetElementPtrInst::Create(tmpVal, $4->begin(), $4->end());
delete $2;
delete $4;
};
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index e948329fe8..1d8def907c 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -122,8 +122,12 @@ namespace {
class ConstantPlaceHolder : public ConstantExpr {
ConstantPlaceHolder(); // DO NOT IMPLEMENT
void operator=(const ConstantPlaceHolder &); // DO NOT IMPLEMENT
- public:
Use Op;
+ public:
+ // allocate space for exactly one operand
+ void *operator new(size_t s) {
+ return User::operator new(s, 1);
+ }
explicit ConstantPlaceHolder(const Type *Ty)
: ConstantExpr(Ty, Instruction::UserOp1, &Op, 1),
Op(UndefValue::get(Type::Int32Ty), this) {
@@ -1046,8 +1050,8 @@ bool BitcodeReader::ParseModule(const std::string &ModuleID) {
if (!FTy)
return Error("Function not a pointer to function type!");
- Function *Func = new Function(FTy, GlobalValue::ExternalLinkage,
- "", TheModule);
+ Function *Func = Function::Create(FTy, GlobalValue::ExternalLinkage,
+ "", TheModule);
Func->setCallingConv(Record[1]);
bool isProto = Record[2];
@@ -1216,7 +1220,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
// Create all the basic blocks for the function.
FunctionBBs.resize(Record[0]);
for (unsigned i = 0, e = FunctionBBs.size(); i != e; ++i)
- FunctionBBs[i] = new BasicBlock("", F);
+ FunctionBBs[i] = BasicBlock::Create("", F);
CurBB = FunctionBBs[0];
continue;
@@ -1270,7 +1274,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
GEPIdx.push_back(Op);
}
- I = new GetElementPtrInst(BasePtr, GEPIdx.begin(), GEPIdx.end());
+ I = GetElementPtrInst::Create(BasePtr, GEPIdx.begin(), GEPIdx.end());
break;
}
@@ -1282,7 +1286,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
getValue(Record, OpNum, Type::Int1Ty, Cond))
return Error("Invalid SELECT record");
- I = new SelectInst(Cond, TrueVal, FalseVal);
+ I = SelectInst::Create(Cond, TrueVal, FalseVal);
break;
}
@@ -1304,7 +1308,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
cast<VectorType>(Vec->getType())->getElementType(), Elt) ||
getValue(Record, OpNum, Type::Int32Ty, Idx))
return Error("Invalid INSERTELT record");
- I = new InsertElementInst(Vec, Elt, Idx);
+ I = InsertElementInst::Create(Vec, Elt, Idx);
break;
}
@@ -1354,7 +1358,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
{
unsigned Size = Record.size();
if (Size == 0) {
- I = new ReturnInst();
+ I = ReturnInst::Create();
break;
} else {
unsigned OpNum = 0;
@@ -1367,7 +1371,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
} while(OpNum != Record.size());
// SmallVector Vs has at least one element.
- I = new ReturnInst(&Vs[0], Vs.size());
+ I = ReturnInst::Create(&Vs[0], Vs.size());
break;
}
}
@@ -1379,13 +1383,13 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
return Error("Invalid BR record");
if (Record.size() == 1)
- I = new BranchInst(TrueDest);
+ I = BranchInst::Create(TrueDest);
else {
BasicBlock *FalseDest = getBasicBlock(Record[1]);
Value *Cond = getFnValueByID(Record[2], Type::Int1Ty);
if (FalseDest == 0 || Cond == 0)
return Error("Invalid BR record");
- I = new BranchInst(TrueDest, FalseDest, Cond);
+ I = BranchInst::Create(TrueDest, FalseDest, Cond);
}
break;
}
@@ -1398,7 +1402,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
if (OpTy == 0 || Cond == 0 || Default == 0)
return Error("Invalid SWITCH record");
unsigned NumCases = (Record.size()-3)/2;
- SwitchInst *SI = new SwitchInst(Cond, Default, NumCases);
+ SwitchInst *SI = SwitchInst::Create(Cond, Default, NumCases);
for (unsigned i = 0, e = NumCases; i != e; ++i) {
ConstantInt *CaseVal =
dyn_cast_or_null<ConstantInt>(getFnValueByID(Record[3+i*2], OpTy));
@@ -1454,7 +1458,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
}
}
- I = new InvokeInst(Callee, NormalBB, UnwindBB, Ops.begin(), Ops.end());
+ I = InvokeInst::Create(Callee, NormalBB, UnwindBB, Ops.begin(), Ops.end());
cast<InvokeInst>(I)->setCallingConv(CCInfo);
cast<InvokeInst>(I)->setParamAttrs(PAL);
break;
@@ -1471,7 +1475,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
const Type *Ty = getTypeByID(Record[0]);
if (!Ty) return Error("Invalid PHI record");
- PHINode *PN = new PHINode(Ty);
+ PHINode *PN = PHINode::Create(Ty);
PN->reserveOperandSpace(Record.size()-1);
for (unsigned i = 0, e = Record.size()-1; i != e; i += 2) {
@@ -1591,7 +1595,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
}
}
- I = new CallInst(Callee, Args.begin(), Args.end());
+ I = CallInst::Create(Callee, Args.begin(), Args.end());
cast<CallInst>(I)->setCallingConv(CCInfo>>1);
cast<CallInst>(I)->setTailCall(CCInfo & 1);
cast<CallInst>(I)->setParamAttrs(PAL);
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp
index 5c0484f2a7..0500bfb496 100644
--- a/lib/CodeGen/IntrinsicLowering.cpp
+++ b/lib/CodeGen/IntrinsicLowering.cpp
@@ -55,8 +55,8 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI,
}
SmallVector<Value *, 8> Args(ArgBegin, ArgEnd);
- CallInst *NewCI = new CallInst(FCache, Args.begin(), Args.end(),
- CI->getName(), CI);
+ CallInst *NewCI = CallInst::Create(FCache, Args.begin(), Args.end(),
+ CI->getName(), CI);
if (!CI->use_empty())
CI->replaceAllUsesWith(NewCI);
return NewCI;
@@ -339,19 +339,19 @@ static Instruction *LowerPartSelect(CallInst *CI) {
Function::arg_iterator args = F->arg_begin();
Value* Val = args++; Val->setName("Val");
Value* Lo = args++; Lo->setName("Lo");
- Value* Hi = args++; Hi->setName("High");
+ Value* Hi = args++; Hi->setName("High");
// We want to select a range of bits here such that [Hi, Lo] is shifted
// down to the low bits. However, it is quite possible that Hi is smaller
// than Lo in which case the bits have to be reversed.
// Create the blocks we will need for the two cases (forward, reverse)
- BasicBlock* CurBB = new BasicBlock("entry", F);
- BasicBlock *RevSize = new BasicBlock("revsize", CurBB->getParent());
- BasicBlock *FwdSize = new BasicBlock("fwdsize", CurBB->getParent());
- BasicBlock *Compute = new BasicBlock("compute", CurBB->getParent());
- BasicBlock *Reverse = new BasicBlock("reverse", CurBB->getParent());
- BasicBlock *RsltBlk = new BasicBlock("result", CurBB->getParent());
+ BasicBlock* CurBB = BasicBlock::Create("entry", F);
+ BasicBlock *RevSize = BasicBlock::Create("revsize", CurBB->getParent());
+ BasicBlock *FwdSize = BasicBlock::Create("fwdsize", CurBB->getParent());
+ BasicBlock *Compute = BasicBlock::Create("compute", CurBB->getParent());
+ BasicBlock *Reverse = BasicBlock::Create("reverse", CurBB->getParent());
+ BasicBlock *RsltBlk = BasicBlock::Create("result", CurBB->getParent());
// Cast Hi and Lo to the size of Val so the widths are all the same
if (Hi->getType() != Val->getType())
@@ -369,17 +369,17 @@ static Instruction *LowerPartSelect(CallInst *CI) {
// Compare the Hi and Lo bit positions. This is used to determine
// which case we have (forward or reverse)
ICmpInst *Cmp = new ICmpInst(ICmpInst::ICMP_ULT, Hi, Lo, "less",CurBB);
- new BranchInst(RevSize, FwdSize, Cmp, CurBB);
+ BranchInst::Create(RevSize, FwdSize, Cmp, CurBB);
// First, copmute the number of bits in the forward case.
Instruction* FBitSize =
BinaryOperator::createSub(Hi, Lo,"fbits", FwdSize);
- new BranchInst(Compute, FwdSize);
+ BranchInst::Create(Compute, FwdSize);
// Second, compute the number of bits in the reverse case.
Instruction* RBitSize =
BinaryOperator::createSub(Lo, Hi, "rbits", RevSize);
- new BranchInst(Compute, RevSize);
+ BranchInst::Create(Compute, RevSize);
// Now, compute the bit range. Start by getting the bitsize and the shift
// amount (either Hi or Lo) from PHI nodes. Then we compute a mask for
@@ -389,13 +389,13 @@ static Instruction *LowerPartSelect(CallInst *CI) {
// reversed.
// Get the BitSize from one of the two subtractions
- PHINode *BitSize = new PHINode(Val->getType(), "bits", Compute);
+ PHINode *BitSize = PHINode::Create(Val->getType(), "bits", Compute);
BitSize->reserveOperandSpace(2);
BitSize->addIncoming(FBitSize, FwdSize);
BitSize->addIncoming(RBitSize, RevSize);
// Get the ShiftAmount as the smaller of Hi/Lo
- PHINode *ShiftAmt = new PHINode(Val->getType(), "shiftamt", Compute);
+ PHINode *ShiftAmt = PHINode::Create(Val->getType(), "shiftamt", Compute);
ShiftAmt->reserveOperandSpace(2);
ShiftAmt->addIncoming(Lo, FwdSize);
ShiftAmt->addIncoming(Hi, RevSize);
@@ -413,24 +413,24 @@ static Instruction *LowerPartSelect(CallInst *CI) {
Instruction* FRes =
BinaryOperator::createLShr(Val, ShiftAmt, "fres", Compute);
FRes = BinaryOperator::createAnd(FRes, Mask, "fres", Compute);
- new BranchInst(Reverse, RsltBlk, Cmp, Compute);
+ BranchInst::Create(Reverse, RsltBlk, Cmp, Compute);
// In the Reverse block we have the mask already in FRes but we must reverse
// it by shifting FRes bits right and putting them in RRes by shifting them
// in from left.
// First set up our loop counters
- PHINode *Count = new PHINode(Val->getType(), "count", Reverse);
+ PHINode *Count = PHINode::Create(Val->getType(), "count", Reverse);
Count->reserveOperandSpace(2);
Count->addIncoming(BitSizePlusOne, Compute);
// Next, get the value that we are shifting.
- PHINode *BitsToShift = new PHINode(Val->getType(), "val", Reverse);
+ PHINode *BitsToShift = PHINode::Create(Val->getType(), "val", Reverse);
BitsToShift->reserveOperandSpace(2);
BitsToShift->addIncoming(FRes, Compute);
// Finally, get the result of the last computation
- PHINode *RRes = new PHINode(Val->getType(), "rres", Reverse);
+ PHINode *RRes = PHINode::Create(Val->getType(), "rres", Reverse);
RRes->reserveOperandSpace(2);
RRes->addIncoming(Zero, Compute);
@@ -456,16 +456,16 @@ static Instruction *LowerPartSelect(CallInst *CI) {
// Terminate loop if we've moved all the bits.
ICmpInst *Cond =
new ICmpInst(ICmpInst::ICMP_EQ, Decr, Zero, "cond", Reverse);
- new BranchInst(RsltBlk, Reverse, Cond, Reverse);
+ BranchInst::Create(RsltBlk, Reverse, Cond, Reverse);
// Finally, in the result block, select one of the two results with a PHI
// node and return the result;
CurBB = RsltBlk;
- PHINode *BitSelect = new PHINode(Val->getType(), "part_select", CurBB);
+ PHINode *BitSelect = PHINode::Create(Val->getType(), "part_select", CurBB);
BitSelect->reserveOperandSpace(2);
BitSelect->addIncoming(FRes, Compute);
BitSelect->addIncoming(NewRes, Reverse);
- new ReturnInst(BitSelect, CurBB);
+ ReturnInst::Create(BitSelect, CurBB);
}
// Return a call to the implementation function
@@ -474,7 +474,7 @@ static Instruction *LowerPartSelect(CallInst *CI) {
CI->getOperand(2),
CI->getOperand(3)
};
- return new CallInst(F, Args, array_endof(Args), CI->getName(), CI);
+ return CallInst::Create(F, Args, array_endof(Args), CI->getName(), CI);
}
/// Convert the llvm.part.set.iX.iY.iZ intrinsic. This intrinsic takes
@@ -531,18 +531,18 @@ static Instruction *LowerPartSet(CallInst *CI) {
ConstantInt* ValZero = ConstantInt::get(ValTy, 0);
// Basic blocks we fill in below.