[llvm] r342688 - [MachineOutliner][NFC] Don't add MBBs with a size < 2 to the search space

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 20 14:53:25 PDT 2018


Author: paquette
Date: Thu Sep 20 14:53:25 2018
New Revision: 342688

URL: http://llvm.org/viewvc/llvm-project?rev=342688&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/CodeGen/MachineOutliner.cpp

Modified: llvm/trunk/lib/CodeGen/MachineOutliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineOutliner.cpp?rev=342688&r1=342687&r2=342688&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineOutliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineOutliner.cpp Thu Sep 20 14:53:25 2018
@@ -1386,7 +1386,11 @@ void MachineOutliner::populateMapper(Ins
     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




More information about the llvm-commits mailing list