More LLVMContext-ification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74807 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson
2009-07-05 22:41:43 +00:00
parent db882950f3
commit 0a205a4598
26 changed files with 162 additions and 98 deletions
+7 -4
View File
@@ -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;
}