[llvm] [AMDGPU] IGroupLP: Refactor SchedGroup::initSchedGroup (NFC) (PR #184122)
Frederik Harwath via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 06:54:42 PST 2026
================
@@ -2572,43 +2568,17 @@ bool SchedGroup::canAddSU(SUnit &SU) const {
return std::all_of(B, E, [this](MachineInstr &MI) { return canAddMI(MI); });
}
-void SchedGroup::initSchedGroup() {
- for (auto &SU : DAG->SUnits) {
- if (isFull())
- break;
-
- if (canAddSU(SU))
- add(SU);
- }
-}
-
-void SchedGroup::initSchedGroup(std::vector<SUnit>::reverse_iterator RIter,
- SUnitsToCandidateSGsMap &SyncedInstrs) {
- SUnit &InitSU = *RIter;
- for (auto E = DAG->SUnits.rend(); RIter != E; ++RIter) {
- auto &SU = *RIter;
- if (isFull())
- break;
-
+template <class T>
+void SchedGroup::findCandidateSUnits(T Begin, T End,
+ SUnitsToCandidateSGsMap &SyncedInstrs) {
+ std::for_each(Begin, End, [this, &SyncedInstrs](SUnit &SU) {
if (canAddSU(SU))
SyncedInstrs[&SU].push_back(SGID);
- }
-
- add(InitSU);
- assert(MaxSize);
- (*MaxSize)++;
+ });
}
-void SchedGroup::initSchedGroup(SUnitsToCandidateSGsMap &SyncedInstrs) {
- auto I = DAG->SUnits.rbegin();
- auto E = DAG->SUnits.rend();
- for (; I != E; ++I) {
- auto &SU = *I;
- if (isFull())
----------------
frederik-h wrote:
The `isFull` call is useless because the function does not even add anything to the SG Collection.
https://github.com/llvm/llvm-project/pull/184122
More information about the llvm-commits
mailing list