Skip to content

[TableGen] Inline a helper function that didn't seem necessary. NFC #123440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions llvm/utils/TableGen/Common/CodeGenSchedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,30 +809,21 @@ void CodeGenSchedModels::expandRWSeqForProc(
}
}

// Find the existing SchedWrite that models this sequence of writes.
unsigned CodeGenSchedModels::findRWForSequence(ArrayRef<unsigned> Seq,
bool IsRead) {
std::vector<CodeGenSchedRW> &RWVec = IsRead ? SchedReads : SchedWrites;

auto I = find_if(RWVec, [Seq](CodeGenSchedRW &RW) {
return ArrayRef(RW.Sequence) == Seq;
});
// Index zero reserved for invalid RW.
return I == RWVec.end() ? 0 : std::distance(RWVec.begin(), I);
}

/// Add this ReadWrite if it doesn't already exist.
unsigned CodeGenSchedModels::findOrInsertRW(ArrayRef<unsigned> Seq,
bool IsRead) {
assert(!Seq.empty() && "cannot insert empty sequence");
if (Seq.size() == 1)
return Seq.back();

unsigned Idx = findRWForSequence(Seq, IsRead);
if (Idx)
return Idx;

std::vector<CodeGenSchedRW> &RWVec = IsRead ? SchedReads : SchedWrites;

auto I = find_if(RWVec, [Seq](CodeGenSchedRW &RW) {
return ArrayRef(RW.Sequence) == Seq;
});
if (I != RWVec.end())
return std::distance(RWVec.begin(), I);

unsigned RWIdx = RWVec.size();
CodeGenSchedRW SchedRW(RWIdx, IsRead, Seq, genRWName(Seq, IsRead));
RWVec.push_back(SchedRW);
Expand Down
1 change: 0 additions & 1 deletion llvm/utils/TableGen/Common/CodeGenSchedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ class CodeGenSchedModels {
void collectSchedRW();

std::string genRWName(ArrayRef<unsigned> Seq, bool IsRead);
unsigned findRWForSequence(ArrayRef<unsigned> Seq, bool IsRead);

void collectSchedClasses();

Expand Down
Loading