diff --git a/pystencils/transformations.py b/pystencils/transformations.py index 06005cbf709fdfeb74a14dc141f0256aee6039cb..09c2e0976ddf14e2745a796e060a79e011d8ca67 100644 --- a/pystencils/transformations.py +++ b/pystencils/transformations.py @@ -638,6 +638,7 @@ def move_constants_before_loop(ast_node): new_symbol = TypedSymbol(sp.Dummy().name, child.lhs.dtype) target.insert_before(ast.SympyAssignment(new_symbol, child.rhs, is_const=child.is_const), child_to_insert_before) + block.append(ast.SympyAssignment(child.lhs, new_symbol, is_const=child.is_const)) def split_inner_loop(ast_node: ast.Node, symbol_groups):