]> granicus.if.org Git - llvm/commitdiff
[MachineOutliner] Only outline candidates of length >= 2
authorJessica Paquette <jpaquette@apple.com>
Mon, 14 Aug 2017 22:57:41 +0000 (22:57 +0000)
committerJessica Paquette <jpaquette@apple.com>
Mon, 14 Aug 2017 22:57:41 +0000 (22:57 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310894 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineOutliner.cpp

index 36163538f4eb4b9eb6967aad7e9c06106a4a90cf..9a8eebff2b5547f2da7938a649b8bd31f25ad30c 100644 (file)
@@ -844,6 +844,13 @@ MachineOutliner::findCandidates(SuffixTree &ST, const TargetInstrInfo &TII,
 
     // 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;