Fix the last of the silly bugs I just introduced. :(

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3674 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-09-10 23:46:10 +00:00
parent 8606d9924b
commit 9e6161cfd1

View File

@@ -240,7 +240,7 @@ bool ADCE::doADCE() {
// //
if (!AliveBlocks.count(&Func->front())) { if (!AliveBlocks.count(&Func->front())) {
BasicBlock *NewEntry = new BasicBlock(); BasicBlock *NewEntry = new BasicBlock();
new BranchInst(&Func->front(), NewEntry->end()); NewEntry->getInstList().push_back(new BranchInst(&Func->front()));
Func->getBasicBlockList().push_front(NewEntry); Func->getBasicBlockList().push_front(NewEntry);
AliveBlocks.insert(NewEntry); // This block is always alive! AliveBlocks.insert(NewEntry); // This block is always alive!
} }
@@ -353,8 +353,8 @@ bool ADCE::doADCE() {
// Delete the old terminator instruction... // Delete the old terminator instruction...
BB->getInstList().pop_back(); BB->getInstList().pop_back();
const Type *RetTy = Func->getReturnType(); const Type *RetTy = Func->getReturnType();
new ReturnInst(RetTy != Type::VoidTy ? Constant::getNullValue(RetTy) :0, BB->getInstList().push_back(new ReturnInst(RetTy != Type::VoidTy ?
BB->end()); Constant::getNullValue(RetTy) : 0));
} }
BB->dropAllReferences(); BB->dropAllReferences();