Skip to content

[MLInliner] Simplify NodeCount bookkeeping #96576

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
Jul 1, 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
4 changes: 2 additions & 2 deletions llvm/lib/Analysis/MLInlineAdvisor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ void MLInlineAdvisor::onPassEntry(LazyCallGraph::SCC *LastSCC) {
// care about the nature of the Edge (call or ref). `FunctionLevels`-wise, we
// record them at the same level as the original node (this is a choice, may
// need revisiting).
NodeCount -= static_cast<int64_t>(NodesInLastSCC.size());
while (!NodesInLastSCC.empty()) {
const auto *N = *NodesInLastSCC.begin();
NodesInLastSCC.erase(N);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this comment is meant for line 213, but github doesn't let me, so..) do you mean to assert (!N->isDead())?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not in this PR, this doesn't change dead function handling

Expand All @@ -215,14 +214,15 @@ void MLInlineAdvisor::onPassEntry(LazyCallGraph::SCC *LastSCC) {
assert(!N->getFunction().isDeclaration());
continue;
}
++NodeCount;
EdgeCount += getLocalCalls(N->getFunction());
const auto NLevel = FunctionLevels.at(N);
for (const auto &E : *(*N)) {
const auto *AdjNode = &E.getNode();
assert(!AdjNode->isDead() && !AdjNode->getFunction().isDeclaration());
auto I = AllNodes.insert(AdjNode);
// We've discovered a new function.
if (I.second) {
++NodeCount;
NodesInLastSCC.insert(AdjNode);
FunctionLevels[AdjNode] = NLevel;
}
Expand Down
Loading