From 1a552d36dc9cb88c8e7f163cfd953efbee4ce639 Mon Sep 17 00:00:00 2001 From: Kyungwoo Lee Date: Mon, 26 Aug 2024 19:03:56 -0700 Subject: [PATCH] [MachineOutlineer][NFC] Remove unnecessary RepeatedSequenceLocs.clear() - When `getOutliningCandidateInfo()` returns `std::nullopt` (meaning no `OutlinedFunction` is created), there is no need to clear the input argument, `RepeatedSequenceLocs`, as it's already beaing cleared in the main loop of `findCandidates()`. - Replaced `2` by `MinRepeats` as I missed this instance from https://github.com/llvm/llvm-project/pull/105398 --- llvm/lib/Target/AArch64/AArch64InstrInfo.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) 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;