[llvm] r310894 - [MachineOutliner] Only outline candidates of length >= 2

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 15:57:41 PDT 2017


Author: paquette
Date: Mon Aug 14 15:57:41 2017
New Revision: 310894

URL: http://llvm.org/viewvc/llvm-project?rev=310894&view=rev
Log:
[MachineOutliner] Only outline candidates of length >= 2

Since we don't factor in instruction lengths into outlining calculations
right now, it's never the case that a candidate could have length < 2.

Thus, we should quit early when we see such candidates.


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=310894&r1=310893&r2=310894&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineOutliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineOutliner.cpp Mon Aug 14 15:57:41 2017
@@ -844,6 +844,13 @@ MachineOutliner::findCandidates(SuffixTr
 
     // Figure out if this candidate is beneficial.
     size_t StringLen = Leaf->ConcatLen - Leaf->size();
+
+    // Too short to be beneficial; skip it.
+    // FIXME: This isn't necessarily true for, say, X86. If we factor in
+    // instruction lengths we need more information than this.
+    if (StringLen < 2)
+      continue;
+
     size_t CallOverhead = 0;
     size_t SequenceOverhead = StringLen;
 




More information about the llvm-commits mailing list