diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/CodeExtractor.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CodeExtractor.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index a22789153df..dbcee9e5755 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -1369,9 +1369,12 @@ Function *CodeExtractor::extractCodeRegion() { DVI->eraseFromParent(); } - // Mark the new function `noreturn` if applicable. + // Mark the new function `noreturn` if applicable. Terminators which resume + // exception propagation are treated as returning instructions. This is to + // avoid inserting traps after calls to outlined functions which unwind. bool doesNotReturn = none_of(*newFunction, [](const BasicBlock &BB) { - return isa<ReturnInst>(BB.getTerminator()); + const Instruction *Term = BB.getTerminator(); + return isa<ReturnInst>(Term) || isa<ResumeInst>(Term); }); if (doesNotReturn) newFunction->setDoesNotReturn(); |