MCPcopy Create free account
hub / github.com/Samsung/ONE / run

Method run

compiler/logo/src/Passes/RemoveDeadNodeWithQueryPass.cpp:29–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27{
28
29bool RemoveDeadNodeWithQueryPass::run(loco::Graph *g)
30{
31 // Let's enumerate nodes required to compute output nodes
32 auto active_nodes = loco::active_nodes(loco::output_nodes(g));
33
34 // List dead(= non-active) nodes candidates
35 std::set<loco::Node *> candidates;
36
37 for (auto node : loco::all_nodes(g))
38 {
39 if (active_nodes.find(node) == active_nodes.end())
40 {
41 candidates.insert(node);
42 }
43 }
44
45 // Find the nodes that should not be dead node in candidates
46 for (auto it = candidates.begin(); it != candidates.end();)
47 {
48 if (auto service = (*it)->dialect()->service<DeadNodeQueryService>())
49 {
50 if (!service->isDeadNode(*it))
51 {
52 it = candidates.erase(it);
53 continue;
54 }
55 }
56 ++it;
57 }
58
59 for (auto node : candidates)
60 {
61 node->drop();
62 }
63
64 for (auto node : candidates)
65 {
66 g->nodes()->destroy(node);
67 }
68
69 return candidates.size() > 0;
70}
71
72} // namespace logo

Callers

nothing calls this directly

Calls 14

active_nodesFunction · 0.85
output_nodesFunction · 0.85
all_nodesFunction · 0.85
isDeadNodeMethod · 0.80
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
dialectMethod · 0.45
eraseMethod · 0.45
dropMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected