From a424ed3a4980b56db81d441fe3dc9b5c76544900 Mon Sep 17 00:00:00 2001 From: Philipp Schaad Date: Wed, 15 Jan 2025 10:42:17 +0100 Subject: [PATCH] Fix a bug where dead state elimination leads to disconnected graphs --- dace/transformation/passes/dead_state_elimination.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dace/transformation/passes/dead_state_elimination.py b/dace/transformation/passes/dead_state_elimination.py index cc7e262e4d..80ecaa49fb 100644 --- a/dace/transformation/passes/dead_state_elimination.py +++ b/dace/transformation/passes/dead_state_elimination.py @@ -77,6 +77,10 @@ def apply_pass(self, sdfg: SDFG, _) -> Optional[Set[Union[SDFGState, Edge[Inters cfg.remove_node(node) else: result.add(node) + is_start = node is cfg.start_block + replacement_pre = cfg.add_state_before(node, node.label + '_pre', is_start_block=is_start) + replacement_post = cfg.add_state_after(node, node.label + '_post') + cfg.add_edge(replacement_pre, replacement_post, InterstateEdge()) cfg.remove_node(node) if not annotated: