Skip to content

Commit 955a032

Browse files
aeubanksanton-bannykh
authored andcommitted
[MLInliner] Simplify NodeCount bookkeeping (llvm#96576)
Rather than doing delta counting of the total number of functions, just increment it when we see a new function. (cherry picked from commit 81f4fb6)
1 parent f0e2970 commit 955a032

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Analysis/MLInlineAdvisor.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ void MLInlineAdvisor::onPassEntry(LazyCallGraph::SCC *CurSCC) {
156156
// they'd be adjacent to Nodes in the last SCC. So we just need to check the
157157
// boundary of Nodes in NodesInLastSCC for Nodes we haven't seen. We don't
158158
// care about the nature of the Edge (call or ref).
159-
NodeCount -= static_cast<int64_t>(NodesInLastSCC.size());
160159
while (!NodesInLastSCC.empty()) {
161160
const auto *N = *NodesInLastSCC.begin();
162161
NodesInLastSCC.erase(N);
@@ -165,14 +164,16 @@ void MLInlineAdvisor::onPassEntry(LazyCallGraph::SCC *CurSCC) {
165164
assert(!N->getFunction().isDeclaration());
166165
continue;
167166
}
168-
++NodeCount;
169167
EdgeCount += getLocalCalls(N->getFunction());
170168
for (const auto &E : *(*N)) {
171169
const auto *AdjNode = &E.getNode();
172170
assert(!AdjNode->isDead() && !AdjNode->getFunction().isDeclaration());
173171
auto I = AllNodes.insert(AdjNode);
174-
if (I.second)
172+
// We've discovered a new function.
173+
if (I.second) {
174+
++NodeCount;
175175
NodesInLastSCC.insert(AdjNode);
176+
}
176177
}
177178
}
178179

0 commit comments

Comments
 (0)