[llvm] f5cae7b - [ORC] Add unit test for simple cycle in WaitingOnGraph::emit. (#169281)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 23 23:07:07 PST 2025


Author: Lang Hames
Date: 2025-11-24T18:07:03+11:00
New Revision: f5cae7b805946337f30437871ea6e13844507775

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

LOG: [ORC] Add unit test for simple cycle in WaitingOnGraph::emit. (#169281)

WaitingOnGraphTests.Emit_SingleContainerSimpleCycle tests a pair of emit
operations where the second completes a simple cycle (1: A -> B, 2: B ->
A).

We already had a test of WaitingOnGraph::simplify's behavior in this
case, but did not have one for WaitingOnGraph::emit.

Added: 
    

Modified: 
    llvm/unittests/ExecutionEngine/Orc/WaitingOnGraphTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/ExecutionEngine/Orc/WaitingOnGraphTest.cpp b/llvm/unittests/ExecutionEngine/Orc/WaitingOnGraphTest.cpp
index 08b4e8f40e3d0..0d4a5212c1f0c 100644
--- a/llvm/unittests/ExecutionEngine/Orc/WaitingOnGraphTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/WaitingOnGraphTest.cpp
@@ -399,6 +399,31 @@ TEST_F(WaitingOnGraphTest, Emit_TrivialSequence) {
   EXPECT_EQ(ER1.Failed.size(), 0U);
 }
 
+TEST_F(WaitingOnGraphTest, Emit_SingleContainerSimpleCycle) {
+  // Test an emit of two nodes with a dependence cycle within a single
+  // container:
+  // N0: (0, 0) -> (0, 1)
+  // N1: (0, 1) -> (0, 0)
+  // We expect intra-simplify cycle elimination to clear both dependence sets,
+  // and coalescing to join them into one supernode covering both defs.
+  SuperNodeBuilder B;
+  ContainerElementsMap Defs0({{0, {0}}});
+  ContainerElementsMap Deps0({{0, {1}}});
+  B.add(Defs0, Deps0);
+
+  auto ER0 = emit(TestGraph::simplify(B.takeSuperNodes()));
+  EXPECT_EQ(ER0.Ready.size(), 0U);
+  EXPECT_EQ(ER0.Failed.size(), 0U);
+
+  ContainerElementsMap Defs1({{0, {1}}});
+  ContainerElementsMap Deps1({{0, {0}}});
+  B.add(Defs1, Deps1);
+  auto ER1 = emit(TestGraph::simplify(B.takeSuperNodes()));
+
+  EXPECT_EQ(collapseDefs(ER1.Ready), merge(Defs0, Defs1));
+  EXPECT_EQ(ER1.Failed.size(), 0U);
+}
+
 TEST_F(WaitingOnGraphTest, Emit_TrivialReverseSequence) {
   // Perform a sequence of two emits where the first emit depends on the
   // second. Check that both nodes become ready after the second emit.


        


More information about the llvm-commits mailing list