From 61ac6ee43a36cdd2d718310e9d4e9ad789fb7a87 Mon Sep 17 00:00:00 2001 From: Philipp Schaad Date: Wed, 13 Nov 2024 09:32:51 +0100 Subject: [PATCH] More fixes --- dace/transformation/passes/constant_propagation.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dace/transformation/passes/constant_propagation.py b/dace/transformation/passes/constant_propagation.py index 19e17066fa..d95b72ab28 100644 --- a/dace/transformation/passes/constant_propagation.py +++ b/dace/transformation/passes/constant_propagation.py @@ -369,6 +369,14 @@ def _collect_constants_for_region(self, cfg: ControlFlowRegion, arrays: Set[str] if reassignments and (used_in_assignments - reassignments): assignments[aname] = _UnknownValue + if isinstance(block, LoopRegion): + # Any constants before a loop that may be overwritten inside the loop cannot be assumed as constants + # for the loop itself. + assigned_in_loop = self._assignments_in_loop(block) + for k in assignments.keys(): + if k in assigned_in_loop: + assignments[k] = _UnknownValue + if block not in in_const_dict: in_const_dict[block] = {} if assignments: