diff --git a/dace/transformation/interstate/block_fusion.py b/dace/transformation/interstate/block_fusion.py index 71736fc269..37da066be2 100644 --- a/dace/transformation/interstate/block_fusion.py +++ b/dace/transformation/interstate/block_fusion.py @@ -1,7 +1,7 @@ # Copyright 2019-2024 ETH Zurich and the DaCe authors. All rights reserved. from dace.sdfg import utils as sdutil -from dace.sdfg.state import ControlFlowBlock, ControlFlowRegion, SDFGState +from dace.sdfg.state import AbstractControlFlowRegion, ControlFlowBlock, ControlFlowRegion, SDFGState from dace.transformation import transformation @@ -53,6 +53,9 @@ def can_be_applied(self, graph, expr_index, sdfg, permissive=False): if out_edges[0].data.assignments: if not in_edges: return False + # If the first block is a control flow region, no absorbtion is possible. + if isinstance(self.first_block, AbstractControlFlowRegion): + return False # Fail if symbol is set before the block to fuse new_assignments = set(out_edges[0].data.assignments.keys()) if any((new_assignments & set(e.data.assignments.keys())) for e in in_edges):