[llvm] [ORC] Further simplify ContainerElementsMap::hoistDeps. NFCI. (PR #185242)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 7 18:12:42 PST 2026


https://github.com/lhames created https://github.com/llvm/llvm-project/pull/185242

At the one call-site where the result of hoistDeps is used, self-dependencies will already have been eliminated. That means we can use the "deps changed" property that we're already computing rather than tracking "deps graph changed" separately.

>From 4b14c80b048361cf844e84fb81b321c6452a0f89 Mon Sep 17 00:00:00 2001
From: Lang Hames <lhames at gmail.com>
Date: Sat, 7 Mar 2026 17:30:40 +1100
Subject: [PATCH] [ORC] Further simplify ContainerElementsMap::hoistDeps. NFCI.

At the one call-site where the result of hoistDeps is used, self-dependencies
will already have been eliminated. That means we can use the "deps changed"
property that we're already computing rather than tracking "deps graph changed"
separately.
---
 llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h b/llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h
index 2ffd6bd6cbffd..28780b0433bda 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h
@@ -280,9 +280,7 @@ template <typename ContainerIdT, typename ElementIdT> class WaitingOnGraph {
     /// Returns true if SuperNodeDeps was changed.
     bool hoistDeps(SuperNodeDepsMap &SuperNodeDeps,
                    ElemToSuperNodeMap &ElemToSN) {
-      bool SuperNodeDepsChanged = false;
-
-      Deps.visit([&](ContainerId &Container, ElementSet &Elements) {
+      return Deps.visit([&](ContainerId &Container, ElementSet &Elements) {
         auto I = ElemToSN.find(Container);
         if (I == ElemToSN.end())
           return false;
@@ -294,15 +292,11 @@ template <typename ContainerIdT, typename ElementIdT> class WaitingOnGraph {
             return false;
 
           auto *DefSN = J->second;
-          if (DefSN != this) {
-            SuperNodeDepsChanged = true;
+          if (DefSN != this)
             SuperNodeDeps[DefSN].insert(this);
-          }
           return true;
         });
       });
-
-      return SuperNodeDepsChanged;
     }
   };
 



More information about the llvm-commits mailing list