summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-30 23:03:37 +0000
committerOwen Anderson <resistor@mac.com>2009-07-30 23:03:37 +0000
commit9e9a0d5fc26878e51a58a8b57900fcbf952c2691 (patch)
tree477eb7b58abe6134ff6accc805279396a77892e8 /lib/Transforms/IPO
parent124e6eb09d47674a4bac48a522e83e4513a970e5 (diff)
downloadllvm-9e9a0d5fc26878e51a58a8b57900fcbf952c2691.tar.gz
llvm-9e9a0d5fc26878e51a58a8b57900fcbf952c2691.tar.bz2
llvm-9e9a0d5fc26878e51a58a8b57900fcbf952c2691.tar.xz
Move more code back to 2.5 APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77635 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp6
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp12
-rw-r--r--lib/Transforms/IPO/IPConstantPropagation.cpp6
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp3
-rw-r--r--lib/Transforms/IPO/PruneEH.cpp2
-rw-r--r--lib/Transforms/IPO/RaiseAllocations.cpp4
-rw-r--r--lib/Transforms/IPO/StripSymbols.cpp2
7 files changed, 16 insertions, 19 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 0b7e9d9874..fbdca723f6 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -758,7 +758,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
}
if (ExtraArgHack)
- Args.push_back(Context.getUndef(Type::Int32Ty));
+ Args.push_back(UndefValue::get(Type::Int32Ty));
// Push any varargs arguments on the list. Don't forget their attributes.
for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) {
@@ -814,7 +814,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
// extract/insertvalue chaining and let instcombine clean that up.
//
// Start out building up our return value from undef
- Value *RetVal = Context.getUndef(RetTy);
+ Value *RetVal = UndefValue::get(RetTy);
for (unsigned i = 0; i != RetCount; ++i)
if (NewRetIdxs[i] != -1) {
Value *V;
@@ -881,7 +881,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
// clean that up.
Value *OldRet = RI->getOperand(0);
// Start out building up our return value from undef
- RetVal = Context.getUndef(NRetTy);
+ RetVal = UndefValue::get(NRetTy);
for (unsigned i = 0; i != RetCount; ++i)
if (NewRetIdxs[i] != -1) {
ExtractValueInst *EV = ExtractValueInst::Create(OldRet, i,
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index e0e5b60b0e..d2a53138cb 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -269,10 +269,10 @@ static Constant *getAggregateConstantElement(Constant *Agg, Constant *Idx,
} else if (isa<UndefValue>(Agg)) {
if (const StructType *STy = dyn_cast<StructType>(Agg->getType())) {
if (IdxV < STy->getNumElements())
- return Context.getUndef(STy->getElementType(IdxV));
+ return UndefValue::get(STy->getElementType(IdxV));
} else if (const SequentialType *STy =
dyn_cast<SequentialType>(Agg->getType())) {
- return Context.getUndef(STy->getElementType());
+ return UndefValue::get(STy->getElementType());
}
}
return 0;
@@ -844,7 +844,7 @@ static GlobalVariable *OptimizeGlobalAddressOfMalloc(GlobalVariable *GV,
// FIXME: This new global should have the alignment returned by malloc. Code
// could depend on malloc returning large alignment (on the mac, 16 bytes) but
// this would only guarantee some lower alignment.
- Constant *Init = Context.getUndef(MI->getAllocatedType());
+ Constant *Init = UndefValue::get(MI->getAllocatedType());
GlobalVariable *NewGV = new GlobalVariable(*GV->getParent(),
MI->getAllocatedType(), false,
GlobalValue::InternalLinkage, Init,
@@ -2056,7 +2056,7 @@ static Constant *EvaluateStoreInto(Constant *Init, Constant *Val,
Elts.push_back(Context.getNullValue(STy->getElementType(i)));
} else if (isa<UndefValue>(Init)) {
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i)
- Elts.push_back(Context.getUndef(STy->getElementType(i)));
+ Elts.push_back(UndefValue::get(STy->getElementType(i)));
} else {
llvm_unreachable("This code is out of sync with "
" ConstantFoldLoadThroughGEPConstantExpr");
@@ -2083,7 +2083,7 @@ static Constant *EvaluateStoreInto(Constant *Init, Constant *Val,
Constant *Elt = Context.getNullValue(ATy->getElementType());
Elts.assign(ATy->getNumElements(), Elt);
} else if (isa<UndefValue>(Init)) {
- Constant *Elt = Context.getUndef(ATy->getElementType());
+ Constant *Elt = UndefValue::get(ATy->getElementType());
Elts.assign(ATy->getNumElements(), Elt);
} else {
llvm_unreachable("This code is out of sync with "
@@ -2227,7 +2227,7 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
const Type *Ty = AI->getType()->getElementType();
AllocaTmps.push_back(new GlobalVariable(Context, Ty, false,
GlobalValue::InternalLinkage,
- Context.getUndef(Ty),
+ UndefValue::get(Ty),
AI->getName()));
InstResult = AllocaTmps.back();
} else if (CallInst *CI = dyn_cast<CallInst>(CurInst)) {
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index adb5242639..4edecc2b23 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -134,7 +134,7 @@ bool IPCP::PropagateConstantsIntoArguments(Function &F) {
continue;
Value *V = ArgumentConstants[i].first;
- if (V == 0) V = F.getContext().getUndef(AI->getType());
+ if (V == 0) V = UndefValue::get(AI->getType());
AI->replaceAllUsesWith(V);
++NumArgumentsProped;
MadeChange = true;
@@ -167,9 +167,9 @@ bool IPCP::PropagateConstantReturn(Function &F) {
const StructType *STy = dyn_cast<StructType>(F.getReturnType());
if (STy)
for (unsigned i = 0, e = STy->getNumElements(); i < e; ++i)
- RetVals.push_back(Context.getUndef(STy->getElementType(i)));
+ RetVals.push_back(UndefValue::get(STy->getElementType(i)));
else
- RetVals.push_back(Context.getUndef(F.getReturnType()));
+ RetVals.push_back(UndefValue::get(F.getReturnType()));
unsigned NumNonConstant = 0;
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp
index d2837a30ed..3a65ac7a8f 100644
--- a/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -289,8 +289,7 @@ void LowerSetJmp::TransformLongJmpCall(CallInst* Inst)
Removed = &BB->back();
// If the removed instructions have any users, replace them now.
if (!Removed->use_empty())
- Removed->replaceAllUsesWith(
- Inst->getContext().getUndef(Removed->getType()));
+ Removed->replaceAllUsesWith(UndefValue::get(Removed->getType()));
Removed->eraseFromParent();
} while (Removed != Inst);
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp
index a98a793461..d2a6530cd9 100644
--- a/lib/Transforms/IPO/PruneEH.cpp
+++ b/lib/Transforms/IPO/PruneEH.cpp
@@ -243,7 +243,7 @@ void PruneEH::DeleteBasicBlock(BasicBlock *BB) {
} else if (InvokeInst *II = dyn_cast<InvokeInst>(I))
CGN->removeCallEdgeFor(II);
if (!I->use_empty())
- I->replaceAllUsesWith(BB->getContext().getUndef(I->getType()));
+ I->replaceAllUsesWith(UndefValue::get(I->getType()));
}
// Get the list of successors of this block.
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index 943d3cf160..0ef0991637 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -142,8 +142,6 @@ bool RaiseAllocations::runOnModule(Module &M) {
// Find the malloc/free prototypes...
doInitialization(M);
- LLVMContext &Context = M.getContext();
-
bool Changed = false;
// First, process all of the malloc calls...
@@ -233,7 +231,7 @@ bool RaiseAllocations::runOnModule(Module &M) {
// Delete the old call site
if (I->getType() != Type::VoidTy)
- I->replaceAllUsesWith(Context.getUndef(I->getType()));
+ I->replaceAllUsesWith(UndefValue::get(I->getType()));
I->eraseFromParent();
Changed = true;
++NumRaised;
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp
index f2b561da80..1bbda3cd22 100644
--- a/lib/Transforms/IPO/StripSymbols.cpp
+++ b/lib/Transforms/IPO/StripSymbols.cpp
@@ -232,7 +232,7 @@ bool StripDebugInfo(Module &M) {
if (!GV) continue;
if (!GV->use_empty() && llvmUsedValues.count(I) == 0) {
if (GV->getName().startswith("llvm.dbg")) {
- GV->replaceAllUsesWith(M.getContext().getUndef(GV->getType()));
+ GV->replaceAllUsesWith(UndefValue::get(GV->getType()));
}
}
}