Skip to content

Commit

Permalink
[MachineOutliner][NFC] Remove unnecessary RepeatedSequenceLocs.clear() (
Browse files Browse the repository at this point in the history
llvm#106171)

- When `getOutliningCandidateInfo()` returns `std::nullopt` (meaning no
`OutlinedFunction` is created), there is no need to clear the input
argument, `RepeatedSequenceLocs`, as it's already being cleared in the
main loop of `findCandidates()`.
- Replaced `2` by `MinRepeats`, which I missed from
llvm#105398
  • Loading branch information
kyulee-com authored Aug 28, 2024
1 parent cc0f2d5 commit 140381d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9003,7 +9003,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);
Expand Down Expand Up @@ -9064,10 +9064,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
Expand All @@ -9092,10 +9090,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;
Expand Down

0 comments on commit 140381d

Please sign in to comment.