aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/BasicBlockUtils.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-05 22:41:43 +0000
committerOwen Anderson <resistor@mac.com>2009-07-05 22:41:43 +0000
commit0a205a459884ec745df1c529396dd921f029dafd (patch)
tree905109491ef6c2ea3d99d01fc48af9c2c633e645 /lib/Transforms/Utils/BasicBlockUtils.cpp
parentdb882950f3bcf7f710843610e917988daeafffc2 (diff)
More LLVMContext-ification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74807 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r--lib/Transforms/Utils/BasicBlockUtils.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp
index 6d1180d0dd..32eecb37aa 100644
--- a/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -16,6 +16,7 @@
#include "llvm/Function.h"
#include "llvm/Instructions.h"
#include "llvm/IntrinsicInst.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Constant.h"
#include "llvm/Type.h"
#include "llvm/Analysis/AliasAnalysis.h"
@@ -49,7 +50,7 @@ void llvm::DeleteDeadBlock(BasicBlock *BB) {
// contained within it must dominate their uses, that all uses will
// eventually be removed (they are themselves dead).
if (!I.use_empty())
- I.replaceAllUsesWith(UndefValue::get(I.getType()));
+ I.replaceAllUsesWith(BB->getContext()->getUndef(I.getType()));
BB->getInstList().pop_back();
}
@@ -69,7 +70,7 @@ void llvm::FoldSingleEntryPHINodes(BasicBlock *BB) {
if (PN->getIncomingValue(0) != PN)
PN->replaceAllUsesWith(PN->getIncomingValue(0));
else
- PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
+ PN->replaceAllUsesWith(BB->getContext()->getUndef(PN->getType()));
PN->eraseFromParent();
}
}
@@ -250,7 +251,8 @@ void llvm::RemoveSuccessor(TerminatorInst *TI, unsigned SuccNum) {
// Create a value to return... if the function doesn't return null...
if (BB->getParent()->getReturnType() != Type::VoidTy)
- RetVal = Constant::getNullValue(BB->getParent()->getReturnType());
+ RetVal = TI->getParent()->getContext()->getNullValue(
+ BB->getParent()->getReturnType());
// Create the return...
NewTI = ReturnInst::Create(RetVal);
@@ -385,7 +387,8 @@ BasicBlock *llvm::SplitBlockPredecessors(BasicBlock *BB,
if (NumPreds == 0) {
// Insert dummy values as the incoming value.
for (BasicBlock::iterator I = BB->begin(); isa<PHINode>(I); ++I)
- cast<PHINode>(I)->addIncoming(UndefValue::get(I->getType()), NewBB);
+ cast<PHINode>(I)->addIncoming(BB->getContext()->getUndef(I->getType()),
+ NewBB);
return NewBB;
}