[llvm] [MLInliner] Simplify NodeCount bookkeeping (PR #96576)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 24 16:43:00 PDT 2024
https://github.com/aeubanks created https://github.com/llvm/llvm-project/pull/96576
Rather than doing delta counting of the total number of functions, just increment it when we see a new function.
>From 3386388645f5b8562367d267c044968eef1e008e Mon Sep 17 00:00:00 2001
From: Arthur Eubanks <aeubanks at google.com>
Date: Mon, 24 Jun 2024 23:41:29 +0000
Subject: [PATCH] [MLInliner] Simplify NodeCount bookkeeping
Rather than doing delta counting of the total number of functions, just increment it when we see a new function.
---
llvm/lib/Analysis/MLInlineAdvisor.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Analysis/MLInlineAdvisor.cpp b/llvm/lib/Analysis/MLInlineAdvisor.cpp
index 21946572339b9..180fac47760cb 100644
--- a/llvm/lib/Analysis/MLInlineAdvisor.cpp
+++ b/llvm/lib/Analysis/MLInlineAdvisor.cpp
@@ -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);
@@ -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;
}
More information about the llvm-commits
mailing list