18TEST(MemoryHoistBarrierTests, normalizeNestedMemoryHoistBarriers)
27 auto & a1 = GraphImport::Create(graph, ptrType,
"a0");
28 auto & a2 = GraphImport::Create(graph, ptrType,
"a1");
29 auto & ioState = GraphImport::Create(graph, ioStateType,
"ioState");
36 auto testNode = TestOperation::createNode(&graph.
GetRootRegion(), { &ioState }, { ioStateType });
40 auto & ctlFalse = ControlConstantOperation::createFalse(graph.
GetRootRegion());
41 auto gammaNode = GammaNode::create(&ctlFalse, 2);
42 auto ptrEntryVar = gammaNode->AddEntryVar(mhbNode1.output(0));
43 auto ioStateEntryVar = gammaNode->AddEntryVar(&ioState);
47 *ptrEntryVar.branchArgument[0],
48 *ioStateEntryVar.branchArgument[0],
55 auto ptrExitVar = gammaNode->AddExitVar({ mhbNode5.output(0), ptrEntryVar.branchArgument[1] });
57 auto & x1 = GraphExport::Create(*mhbNode1.output(0),
"x1");
58 auto & x2 = GraphExport::Create(*mhbNode2.output(0),
"x2");
59 auto & x3 = GraphExport::Create(*mhbNode3.output(0),
"x3");
60 auto & x4 = GraphExport::Create(*mhbNode4.output(0),
"x4");
61 GraphExport::Create(*ptrExitVar.output,
"x5");
64 ReduceNode<MemoryHoistBarrierOperation>(
67 ReduceNode<MemoryHoistBarrierOperation>(
70 ReduceNode<MemoryHoistBarrierOperation>(
73 ReduceNode<MemoryHoistBarrierOperation>(
76 ReduceNode<MemoryHoistBarrierOperation>(
83 EXPECT_EQ(x1.origin(), mhbNode1.output(0));
88 auto [mhbNode, mhbOp] =
90 EXPECT_NE(mhbNode,
nullptr);
91 EXPECT_EQ(mhbOp->getDereferenceableSize(), 1);
92 EXPECT_EQ(mhbNode->input(0)->origin(), &a1);
93 EXPECT_EQ(mhbNode->input(1)->origin(), &ioState);
98 EXPECT_EQ(x3.origin(), mhbNode3.output(0));
103 EXPECT_EQ(x4.origin(), mhbNode4.output(0));
108 EXPECT_EQ(ptrExitVar.branchResult[0]->origin(), mhbNode5.output(0));