summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp5
-rw-r--r--llvm/lib/Target/AArch64/AArch64InstrInfo.cpp4
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 1a3a2cfb93e..6b9faddd9b2 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -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;
diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
index 436a6f11817..176514dd361 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
@@ -5165,8 +5165,8 @@ AArch64InstrInfo::getOutliningCandidateInfo(
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
OpenPOWER on IntegriCloud