diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/IPO/HotColdSplitting.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp index 36dd6fa4be7..65e7938720d 100644 --- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp +++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp @@ -135,8 +135,12 @@ static bool mayExtractBlock(const BasicBlock &BB) { // EH pads are unsafe to outline because doing so breaks EH type tables. It // follows that invoke instructions cannot be extracted, because CodeExtractor // requires unwind destinations to be within the extraction region. - return !BB.hasAddressTaken() && !BB.isEHPad() && - !isa<InvokeInst>(BB.getTerminator()); + // + // Resumes that are not reachable from a cleanup landing pad are considered to + // be unreachable. It’s not safe to split them out either. + auto Term = BB.getTerminator(); + return !BB.hasAddressTaken() && !BB.isEHPad() && !isa<InvokeInst>(Term) && + !isa<ResumeInst>(Term); } /// Mark \p F cold. Based on this assumption, also optimize it for minimum size. |