Skip to content
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

[MISched][NFC] Add documentation comment in pickNode for ReadyQueue maintenence #92976

Merged
merged 1 commit into from
May 22, 2024
Merged
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
15 changes: 15 additions & 0 deletions llvm/lib/CodeGen/MachineScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3777,6 +3777,21 @@ SUnit *GenericScheduler::pickNode(bool &IsTopNode) {
}
} while (SU->isScheduled);

// If IsTopNode, then SU is in Top.Available and must be removed. Otherwise,
// if isTopReady(), then SU is in either Top.Available or Top.Pending.
// If !IsTopNode, then SU is in Bot.Available and must be removed. Otherwise,
// if isBottomReady(), then SU is in either Bot.Available or Bot.Pending.
//
// It is coincidental when !IsTopNode && isTopReady or when IsTopNode &&
// isBottomReady. That is, it didn't factor into the decision to choose SU
// because it isTopReady or isBottomReady, respectively. In fact, if the
// RegionPolicy is OnlyTopDown or OnlyBottomUp, then the Bot queues and Top
// queues respectivley contain the original roots and don't get updated when
// picking a node. So if SU isTopReady on a OnlyBottomUp pick, then it was
// because we schduled everything but the top roots. Conversley, if SU
// isBottomReady on OnlyTopDown, then it was because we scheduled everything
// but the bottom roots. If its in a queue even coincidentally, it should be
// removed so it does not get re-picked in a subsequent pickNode call.
if (SU->isTopReady())
Top.removeReady(SU);
if (SU->isBottomReady())
Expand Down
Loading