Skip to content

Commit 81f4fb6

Browse files
authored
[MLInliner] Simplify NodeCount bookkeeping (#96576)
Rather than doing delta counting of the total number of functions, just increment it when we see a new function.
1 parent 7e6e498 commit 81f4fb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llvm/lib/Analysis/MLInlineAdvisor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ void MLInlineAdvisor::onPassEntry(LazyCallGraph::SCC *CurSCC) {
211211
// care about the nature of the Edge (call or ref). `FunctionLevels`-wise, we
212212
// record them at the same level as the original node (this is a choice, may
213213
// need revisiting).
214-
NodeCount -= static_cast<int64_t>(NodesInLastSCC.size());
215214
while (!NodesInLastSCC.empty()) {
216215
const auto *N = *NodesInLastSCC.begin();
217216
NodesInLastSCC.erase(N);
@@ -220,14 +219,15 @@ void MLInlineAdvisor::onPassEntry(LazyCallGraph::SCC *CurSCC) {
220219
assert(!N->getFunction().isDeclaration());
221220
continue;
222221
}
223-
++NodeCount;
224222
EdgeCount += getLocalCalls(N->getFunction());
225223
const auto NLevel = FunctionLevels.at(N);
226224
for (const auto &E : *(*N)) {
227225
const auto *AdjNode = &E.getNode();
228226
assert(!AdjNode->isDead() && !AdjNode->getFunction().isDeclaration());
229227
auto I = AllNodes.insert(AdjNode);
228+
// We've discovered a new function.
230229
if (I.second) {
230+
++NodeCount;
231231
NodesInLastSCC.insert(AdjNode);
232232
FunctionLevels[AdjNode] = NLevel;
233233
}

0 commit comments

Comments
 (0)