aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp10
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp12
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp8
3 files changed, 14 insertions, 16 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index 472f4ea..90077cd 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -638,9 +638,9 @@ Function *ArgPromotion::DoPromotion(Function *F,
// Emit a GEP and load for each element of the struct.
const Type *AgTy = cast<PointerType>(I->getType())->getElementType();
const StructType *STy = cast<StructType>(AgTy);
- Value *Idxs[2] = { Context.getConstantInt(Type::Int32Ty, 0), 0 };
+ Value *Idxs[2] = { ConstantInt::get(Type::Int32Ty, 0), 0 };
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
- Idxs[1] = Context.getConstantInt(Type::Int32Ty, i);
+ Idxs[1] = ConstantInt::get(Type::Int32Ty, i);
Value *Idx = GetElementPtrInst::Create(*AI, Idxs, Idxs+2,
(*AI)->getName()+"."+utostr(i),
Call);
@@ -665,7 +665,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
// Use i32 to index structs, and i64 for others (pointers/arrays).
// This satisfies GEP constraints.
const Type *IdxTy = (isa<StructType>(ElTy) ? Type::Int32Ty : Type::Int64Ty);
- Ops.push_back(Context.getConstantInt(IdxTy, *II));
+ Ops.push_back(ConstantInt::get(IdxTy, *II));
// Keep track of the type we're currently indexing
ElTy = cast<CompositeType>(ElTy)->getTypeAtIndex(*II);
}
@@ -758,10 +758,10 @@ Function *ArgPromotion::DoPromotion(Function *F,
const Type *AgTy = cast<PointerType>(I->getType())->getElementType();
Value *TheAlloca = new AllocaInst(AgTy, 0, "", InsertPt);
const StructType *STy = cast<StructType>(AgTy);
- Value *Idxs[2] = { Context.getConstantInt(Type::Int32Ty, 0), 0 };
+ Value *Idxs[2] = { ConstantInt::get(Type::Int32Ty, 0), 0 };
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
- Idxs[1] = Context.getConstantInt(Type::Int32Ty, i);
+ Idxs[1] = ConstantInt::get(Type::Int32Ty, i);
Value *Idx =
GetElementPtrInst::Create(TheAlloca, Idxs, Idxs+2,
TheAlloca->getName()+"."+utostr(i),
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index b0363d3..c16db83 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -488,7 +488,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const TargetData &TD,
const StructLayout &Layout = *TD.getStructLayout(STy);
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
Constant *In = getAggregateConstantElement(Init,
- Context.getConstantInt(Type::Int32Ty, i),
+ ConstantInt::get(Type::Int32Ty, i),
Context);
assert(In && "Couldn't get element of initializer?");
GlobalVariable *NGV = new GlobalVariable(Context,
@@ -523,7 +523,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const TargetData &TD,
unsigned EltAlign = TD.getABITypeAlignment(STy->getElementType());
for (unsigned i = 0, e = NumElements; i != e; ++i) {
Constant *In = getAggregateConstantElement(Init,
- Context.getConstantInt(Type::Int32Ty, i),
+ ConstantInt::get(Type::Int32Ty, i),
Context);
assert(In && "Couldn't get element of initializer?");
@@ -1508,7 +1508,7 @@ static bool TryToOptimizeStoreOfMallocToGlobal(GlobalVariable *GV,
if (const ArrayType *AT = dyn_cast<ArrayType>(MI->getAllocatedType())) {
MallocInst *NewMI =
new MallocInst(AllocSTy,
- Context.getConstantInt(Type::Int32Ty, AT->getNumElements()),
+ ConstantInt::get(Type::Int32Ty, AT->getNumElements()),
"", MI);
NewMI->takeName(MI);
Value *Cast = new BitCastInst(NewMI, MI->getType(), "tmp", MI);
@@ -1605,7 +1605,7 @@ static bool TryToShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal,
// Only do this if we weren't storing a loaded value.
Value *StoreVal;
if (StoringOther || SI->getOperand(0) == InitVal)
- StoreVal = Context.getConstantInt(Type::Int1Ty, StoringOther);
+ StoreVal = ConstantInt::get(Type::Int1Ty, StoringOther);
else {
// Otherwise, we are storing a previously loaded copy. To do this,
// change the copy from copying the original value to just copying the
@@ -1947,7 +1947,7 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL,
LLVMContext &Context) {
// If we made a change, reassemble the initializer list.
std::vector<Constant*> CSVals;
- CSVals.push_back(Context.getConstantInt(Type::Int32Ty, 65535));
+ CSVals.push_back(ConstantInt::get(Type::Int32Ty, 65535));
CSVals.push_back(0);
// Create the new init list.
@@ -1959,7 +1959,7 @@ static GlobalVariable *InstallGlobalCtors(GlobalVariable *GCL,
const Type *FTy = Context.getFunctionType(Type::VoidTy, false);
const PointerType *PFTy = Context.getPointerTypeUnqual(FTy);
CSVals[1] = Context.getNullValue(PFTy);
- CSVals[0] = Context.getConstantInt(Type::Int32Ty, 2147483647);
+ CSVals[0] = ConstantInt::get(Type::Int32Ty, 2147483647);
}
CAList.push_back(Context.getConstantStruct(CSVals));
}
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp
index e5ac22e..980123a 100644
--- a/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -383,8 +383,7 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst)
new BitCastInst(Inst->getOperand(1), SBPTy, "SBJmpBuf", Inst);
std::vector<Value*> Args =
make_vector<Value*>(GetSetJmpMap(Func), BufPtr,
- Inst->getContext().getConstantInt(Type::Int32Ty,
- SetJmpIDMap[Func]++), 0);
+ ConstantInt::get(Type::Int32Ty,SetJmpIDMap[Func]++), 0);
CallInst::Create(AddSJToMap, Args.begin(), Args.end(), "", Inst);
// We are guaranteed that there are no values live across basic blocks
@@ -434,9 +433,8 @@ void LowerSetJmp::TransformSetJmpCall(CallInst* Inst)
// Add the case for this setjmp's number...
SwitchValuePair SVP = GetSJSwitch(Func, GetRethrowBB(Func));
- SVP.first->addCase(Inst->getContext().getConstantInt(Type::Int32Ty,
- SetJmpIDMap[Func] - 1),
- SetJmpContBlock);
+ SVP.first->addCase(ConstantInt::get(Type::Int32Ty, SetJmpIDMap[Func] - 1),
+ SetJmpContBlock);
// Value coming from the handling of the exception.
PHI->addIncoming(SVP.second, SVP.second->getParent());