From aa8e754262c347fa2988cf21635179ec03392cf3 Mon Sep 17 00:00:00 2001 From: Michael Bryman Date: Tue, 26 Mar 2019 11:30:01 -0400 Subject: fixed bug in IntrinsicCleaner trap cleaner --- lib/Module/IntrinsicCleaner.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Module/IntrinsicCleaner.cpp b/lib/Module/IntrinsicCleaner.cpp index e2ed3f39..19683ab4 100644 --- a/lib/Module/IntrinsicCleaner.cpp +++ b/lib/Module/IntrinsicCleaner.cpp @@ -207,6 +207,14 @@ bool IntrinsicCleanerPass::runOnBasicBlock(BasicBlock &b, Module &M) { ii->eraseFromParent(); + //check if the instruction after the one we just replaced is not the end of the basic block + //and if it is not (i.e. it is a valid instruction), delete it and all remaining + //because the cleaner just introduced a terminating instruction (unreachable) + //otherwise llvm will assert in Verifier::visitTerminatorInstr + while(i != ie){ // i was already incremented above. + (i++)->eraseFromParent(); + } + dirty = true; break; } -- cgit 1.4.1