diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index 36163538f4eb..9a8eebff2b55 100644 --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -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;