From d9aac4c473db5eccf1e85f74eabbe3fda488cd35 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 8 Nov 2015 04:16:12 +0000 Subject: [PATCH] Make bugpoint ehpad/token friendly Tokens shouldn't be blindly replaced with undef/null. Also, don't try to remove EH pad instructions from the top of basic blocks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252414 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/bugpoint/CrashDebugger.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index 91bf033ac9c..1bfcc87e06e 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -373,8 +373,9 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector &BBs) { (*SI)->removePredecessor(&*BB); TerminatorInst *BBTerm = BB->getTerminator(); - - if (!BB->getTerminator()->getType()->isVoidTy()) + if (BBTerm->isEHPad()) + continue; + if (!BBTerm->getType()->isVoidTy() && !BBTerm->getType()->isTokenTy()) BBTerm->replaceAllUsesWith(Constant::getNullValue(BBTerm->getType())); // Replace the old terminator instruction. @@ -476,7 +477,7 @@ bool ReduceCrashingInstructions::TestInsts(std::vector Instruction *Inst = &*I++; if (!Instructions.count(Inst) && !isa(Inst) && !Inst->isEHPad()) { - if (!Inst->getType()->isVoidTy()) + if (!Inst->getType()->isVoidTy() && !Inst->getType()->isTokenTy()) Inst->replaceAllUsesWith(UndefValue::get(Inst->getType())); Inst->eraseFromParent(); } @@ -785,7 +786,7 @@ static bool DebugACrash(BugDriver &BD, } else { if (BugpointIsInterrupted) goto ExitLoops; - if (isa(I)) + if (I->isEHPad() || I->getType()->isTokenTy()) continue; outs() << "Checking instruction: " << *I; -- 2.34.1