[PATCH] D70929: Don't extract code containing an indirect jump from a callbr
Bill Wendling via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 2 15:21:22 PST 2019
void updated this revision to Diff 231788.
void added a comment.
Use range-based for loop.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70929/new/
https://reviews.llvm.org/D70929
Files:
llvm/lib/Transforms/IPO/HotColdSplitting.cpp
Index: llvm/lib/Transforms/IPO/HotColdSplitting.cpp
===================================================================
--- llvm/lib/Transforms/IPO/HotColdSplitting.cpp
+++ llvm/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -129,6 +129,13 @@
/// Check whether it's safe to outline \p BB.
static bool mayExtractBlock(const BasicBlock &BB) {
+ // Don't extract the indirect destination of a "callbr" instruction as even
+ // though it's ice cold it's not safe to extract it, for reasons similar to
+ // extracting an EH block.
+ for (const auto *pred : predecessors(&BB))
+ if (isa<CallBrInst>(pred->getTerminator()))
+ return false;
+
// 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.
@@ -137,7 +144,7 @@
// 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);
+ !isa<ResumeInst>(Term) && !isa<CallBrInst>(Term);
}
/// Mark \p F cold. Based on this assumption, also optimize it for minimum size.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70929.231788.patch
Type: text/x-patch
Size: 1257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191202/6cedb0e2/attachment.bin>
More information about the llvm-commits
mailing list