diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index 1423dc4996c2e..397c271083c72 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -8990,7 +8990,7 @@ AArch64InstrInfo::getOutliningCandidateInfo( NumBytesNoStackCalls <= RepeatedSequenceLocs.size() * 12) { RepeatedSequenceLocs = CandidatesWithoutStackFixups; FrameID = MachineOutlinerNoLRSave; - if (RepeatedSequenceLocs.size() < 2) + if (RepeatedSequenceLocs.size() < MinRepeats) return std::nullopt; } else { SetCandidateCallInfo(MachineOutlinerDefault, 12); @@ -9051,10 +9051,8 @@ AArch64InstrInfo::getOutliningCandidateInfo( } // If we dropped all of the candidates, bail out here. - if (RepeatedSequenceLocs.size() < MinRepeats) { - RepeatedSequenceLocs.clear(); + if (RepeatedSequenceLocs.size() < MinRepeats) return std::nullopt; - } } // Does every candidate's MBB contain a call? If so, then we might have a call @@ -9079,10 +9077,8 @@ AArch64InstrInfo::getOutliningCandidateInfo( if (ModStackToSaveLR) { // We can't fix up the stack. Bail out. - if (!AllStackInstrsSafe) { - RepeatedSequenceLocs.clear(); + if (!AllStackInstrsSafe) return std::nullopt; - } // Save + restore LR. NumBytesToCreateFrame += 8;