diff options
| author | Chris Lattner <sabre@nondot.org> | 2003-11-22 02:10:38 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2003-11-22 02:10:38 +0000 |
| commit | 7b233af2476eea3210f4a5736012b75a0b3cdbc4 (patch) | |
| tree | 6076f4a173814abd4f1baee2ca5117d3317aaf22 /llvm/tools/bugpoint/CrashDebugger.cpp | |
| parent | 1e6089c2d6490f990e45a607226ecf62313ce26f (diff) | |
| download | bcm5719-llvm-7b233af2476eea3210f4a5736012b75a0b3cdbc4.tar.gz bcm5719-llvm-7b233af2476eea3210f4a5736012b75a0b3cdbc4.zip | |
Do not crash when dealing with invoke and unwind instructions!
llvm-svn: 10160
Diffstat (limited to 'llvm/tools/bugpoint/CrashDebugger.cpp')
| -rw-r--r-- | llvm/tools/bugpoint/CrashDebugger.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp index 8c29ea226a4..af64d7a9af6 100644 --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/tools/bugpoint/CrashDebugger.cpp @@ -195,20 +195,23 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector<BasicBlock*> &BBs) { // Loop over and delete any hack up any blocks that are not listed... for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) for (Function::iterator BB = I->begin(), E = I->end(); BB != E; ++BB) - if (!Blocks.count(BB) && !isa<ReturnInst>(BB->getTerminator())) { + if (!Blocks.count(BB) && BB->getTerminator()->getNumSuccessors()) { // Loop over all of the successors of this block, deleting any PHI nodes // that might include it. for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI) (*SI)->removePredecessor(BB); + if (BB->getTerminator()->getType() != Type::VoidTy) + BB->getTerminator()->replaceAllUsesWith( + Constant::getNullValue(BB->getTerminator()->getType())); + // Delete the old terminator instruction... BB->getInstList().pop_back(); // Add a new return instruction of the appropriate type... const Type *RetTy = BB->getParent()->getReturnType(); - ReturnInst *RI = new ReturnInst(RetTy == Type::VoidTy ? 0 : - Constant::getNullValue(RetTy)); - BB->getInstList().push_back(RI); + new ReturnInst(RetTy == Type::VoidTy ? 0 : + Constant::getNullValue(RetTy), BB); } // The CFG Simplifier pass may delete one of the basic blocks we are |

