[llvm] 40713f2 - [ORC] Refactor WaitingOnGraph::processExternalDeps. NFCI. (#185152)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 22:25:37 PST 2026


Author: Lang Hames
Date: 2026-03-07T17:25:33+11:00
New Revision: 40713f2a87c808213e91d7e5eba7276176ed5e91

URL: https://github.com/llvm/llvm-project/commit/40713f2a87c808213e91d7e5eba7276176ed5e91
DIFF: https://github.com/llvm/llvm-project/commit/40713f2a87c808213e91d7e5eba7276176ed5e91.diff

LOG: [ORC] Refactor WaitingOnGraph::processExternalDeps. NFCI. (#185152)

Refactor WaitingOnGraph::processExternalDeps to use the recently
introduced ContainerElementsMap::visit and ElementSet::remove_if
methods.

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h b/llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h
index 9cd534fa446a7..2ffd6bd6cbffd 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/WaitingOnGraph.h
@@ -725,34 +725,20 @@ template <typename ContainerIdT, typename ElementIdT> class WaitingOnGraph {
   processExternalDeps(std::vector<std::unique_ptr<SuperNode>> &SNs,
                       GetExternalStateFn &GetExternalState) {
     DenseSet<SuperNode *> FailedSNs;
-    for (auto &SN : SNs) {
-      bool SNHasError = false;
-      SmallVector<ContainerId> ContainersToRemove;
-      for (auto &[Container, Elems] : SN->Deps) {
-        SmallVector<ElementId> ElemToRemove;
-        for (auto &Elem : Elems) {
+    for (auto &SN : SNs)
+      SN->Deps.visit([&](ContainerId &Container, ElementSet &Elements) {
+        return Elements.remove_if([&](ElementId &Elem) {
           switch (GetExternalState(Container, Elem)) {
           case ExternalState::None:
-            break;
+            return false;
           case ExternalState::Ready:
-            ElemToRemove.push_back(Elem);
-            break;
+            return true;
           case ExternalState::Failed:
-            ElemToRemove.push_back(Elem);
-            SNHasError = true;
-            break;
-          }
-        }
-        for (auto &Elem : ElemToRemove)
-          Elems.erase(Elem);
-        if (Elems.empty())
-          ContainersToRemove.push_back(Container);
-      }
-      for (auto &Container : ContainersToRemove)
-        SN->Deps.erase(Container);
-      if (SNHasError)
-        FailedSNs.insert(SN.get());
-    }
+            FailedSNs.insert(SN.get());
+            return true;
+          };
+        });
+      });
 
     return FailedSNs;
   }


        


More information about the llvm-commits mailing list