[llvm] r346803 - [MachineOutliner][NFC] Exit getOutliningType if there are < 2 candidates

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 13 14:16:28 PST 2018


Author: paquette
Date: Tue Nov 13 14:16:27 2018
New Revision: 346803

URL: http://llvm.org/viewvc/llvm-project?rev=346803&view=rev
Log:
[MachineOutliner][NFC] Exit getOutliningType if there are < 2 candidates

Since we never outline anything with fewer than 2 occurrences, there's no
reason to compute cost model information if there's less than that.

Modified:
    llvm/trunk/lib/CodeGen/MachineOutliner.cpp
    llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp

Modified: llvm/trunk/lib/CodeGen/MachineOutliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineOutliner.cpp?rev=346803&r1=346802&r2=346803&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineOutliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineOutliner.cpp Tue Nov 13 14:16:27 2018
@@ -1127,8 +1127,9 @@ unsigned MachineOutliner::findCandidates
     OutlinedFunction OF =
         TII->getOutliningCandidateInfo(CandidatesForRepeatedSeq);
 
-    // If we deleted every candidate, then there's nothing to outline.
-    if (OF.Candidates.empty())
+    // If we deleted too many candidates, then there's nothing worth outlining.
+    // FIXME: This should take target-specified instruction sizes into account.
+    if (OF.Candidates.size() < 2)
       continue;
 
     std::vector<unsigned> Seq;

Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp?rev=346803&r1=346802&r2=346803&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Tue Nov 13 14:16:27 2018
@@ -5165,8 +5165,8 @@ AArch64InstrInfo::getOutliningCandidateI
                                             CantGuaranteeValueAcrossCall),
                              RepeatedSequenceLocs.end());
 
-  // If the sequence is empty, we're done.
-  if (RepeatedSequenceLocs.empty())
+  // If the sequence doesn't have enough candidates left, then we're done.
+  if (RepeatedSequenceLocs.size() < 2)
     return outliner::OutlinedFunction();
 
   // At this point, we have only "safe" candidates to outline. Figure out




More information about the llvm-commits mailing list