diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-28 00:04:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-28 00:04:58 +0000 |
commit | e78109eb3a3d177d03cea40b46d9dcfc9bf32210 (patch) | |
tree | e64c760b898adf3fc9d4f1090edd3bc22003d183 /tools/bugpoint/CrashDebugger.cpp | |
parent | f899fce0c0492a6fa405323c073b3380260e5806 (diff) | |
download | llvm-e78109eb3a3d177d03cea40b46d9dcfc9bf32210.tar.gz llvm-e78109eb3a3d177d03cea40b46d9dcfc9bf32210.tar.bz2 llvm-e78109eb3a3d177d03cea40b46d9dcfc9bf32210.tar.xz |
several multiple-retval fixes for bugpoint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50331 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/CrashDebugger.cpp')
-rw-r--r-- | tools/bugpoint/CrashDebugger.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index d86d1c5969..7dcbfe3c4a 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -14,7 +14,7 @@ #include "BugDriver.h" #include "ToolRunner.h" #include "ListReducer.h" -#include "llvm/Constant.h" +#include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" #include "llvm/Module.h" @@ -300,17 +300,16 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) { 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())); + TerminatorInst *BBTerm = BB->getTerminator(); + + if (isa<StructType>(BBTerm->getType())) + BBTerm->replaceAllUsesWith(UndefValue::get(BBTerm->getType())); + else if (BB->getTerminator()->getType() != Type::VoidTy) + BBTerm->replaceAllUsesWith(Constant::getNullValue(BBTerm->getType())); - // Delete the old terminator instruction... + // Replace the old terminator instruction. BB->getInstList().pop_back(); - - // Add a new return instruction of the appropriate type... - const Type *RetTy = BB->getParent()->getReturnType(); - ReturnInst::Create(RetTy == Type::VoidTy ? 0 : - Constant::getNullValue(RetTy), BB); + new UnreachableInst(BB); } // The CFG Simplifier pass may delete one of the basic blocks we are |