[llvm] [MachineOutlineer][NFC] Remove unnecessary RepeatedSequenceLocs.clear() (PR #106171)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 14:56:20 PDT 2024
https://github.com/kyulee-com updated https://github.com/llvm/llvm-project/pull/106171
>From 09fd2e0cb23847f6257525fbfdb13ab5c2b6e2e3 Mon Sep 17 00:00:00 2001
From: Kyungwoo Lee <kyulee at meta.com>
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 1423dc4996c2ed..397c271083c721 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;
More information about the llvm-commits
mailing list