[llvm] [RISCV] [MachineOutliner] Analyze all candidates (PR #127659)
Sudharsan Veeravalli via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 21:05:24 PST 2025
================
@@ -3047,35 +3042,32 @@ RISCVInstrInfo::getOutliningCandidateInfo(
std::vector<outliner::Candidate> &RepeatedSequenceLocs,
unsigned MinRepeats) const {
- // Each RepeatedSequenceLoc is identical.
- outliner::Candidate &Candidate = RepeatedSequenceLocs[0];
- auto CandidateInfo = analyzeCandidate(Candidate);
- if (!CandidateInfo)
- RepeatedSequenceLocs.clear();
+ // Analyze each candidate and erase the ones that are not viable.
+ llvm::erase_if(RepeatedSequenceLocs, analyzeCandidate);
// If the sequence doesn't have enough candidates left, then we're done.
if (RepeatedSequenceLocs.size() < MinRepeats)
return std::nullopt;
+ // Each RepeatedSequenceLoc is identical.
+ outliner::Candidate &Candidate = RepeatedSequenceLocs[0];
unsigned InstrSizeCExt =
Candidate.getMF()->getSubtarget<RISCVSubtarget>().hasStdExtCOrZca() ? 2
: 4;
----------------
svs-quic wrote:
> I think we do have to care a little about which call we can use because the call instruction will not show up in the candidate sequence (which is a bit different to what's pointed out in that comment).
Yeah this is true for the MachineOutlinerTailCall case but for the MachineOutlinerDefault case we have a `jr t0` in the outlined function that can be compressed.
https://github.com/llvm/llvm-project/pull/127659
More information about the llvm-commits
mailing list