From b320ca264216cb09d70927792f6f3d04bca7f58b Mon Sep 17 00:00:00 2001 From: Jessica Paquette Date: Thu, 20 Sep 2018 21:53:25 +0000 Subject: [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 --- llvm/lib/CodeGen/MachineOutliner.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index 5cefaf49294..4b65d971a78 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 -- cgit v1.2.3