[llvm] [Inliner] Handle CGSCC changes from #94815 (PR #96274)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 07:42:43 PDT 2024


================
@@ -206,23 +206,18 @@ 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();
+    assert(!N->isDead());
     NodesInLastSCC.erase(N);
-    // The Function wrapped by N could have been deleted since we last saw it.
-    if (N->isDead()) {
-      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);
       if (I.second) {
+        ++NodeCount;
----------------
mtrofin wrote:

why do we need to bump here and not when we re-enter the traversal (i.e. original place of the bump)? SGTM if it's stylistic and more easily readable, but want to check I'm not missing something functionally.

https://github.com/llvm/llvm-project/pull/96274


More information about the llvm-commits mailing list