aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOutliner.cpp
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2018-09-20 21:53:25 +0000
committerJessica Paquette <jpaquette@apple.com>2018-09-20 21:53:25 +0000
commitb320ca264216cb09d70927792f6f3d04bca7f58b (patch)
tree5e2e1cd4f1ebc2eb0e9fe95712b37937f278689d /llvm/lib/CodeGen/MachineOutliner.cpp
parenta07166995667a86af8856d052671d3f2ef07fcb9 (diff)
downloadllvm-b320ca264216cb09d70927792f6f3d04bca7f58b.zip
llvm-b320ca264216cb09d70927792f6f3d04bca7f58b.tar.gz
llvm-b320ca264216cb09d70927792f6f3d04bca7f58b.tar.bz2
[MachineOutliner][NFC] Don't add MBBs with a size < 2 to the search space
The suffix tree won't ever consider sequences with a length less than 2. Therefore, we really ought to not even consider them in the first place. Also add a FIXME explaining that this should be defined in terms of the size in B of an outlined call versus the size in B of the MBB. llvm-svn: 342688
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 5cefaf4..4b65d97 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1386,7 +1386,11 @@ void MachineOutliner::populateMapper(InstructionMapper &Mapper, Module &M,
for (MachineBasicBlock &MBB : *MF) {
// If there isn't anything in MBB, then there's no point in outlining from
// it.
- if (MBB.empty())
+ // If there are fewer than 2 instructions in the MBB, then it can't ever
+ // contain something worth outlining.
+ // FIXME: This should be based off of the maximum size in B of an outlined
+ // call versus the size in B of the MBB.
+ if (MBB.empty() || MBB.size() < 2)
continue;
// Check if MBB could be the target of an indirect branch. If it is, then