Skip to content
Snippets Groups Projects
Commit 354fede8 authored by Jan Hönig's avatar Jan Hönig
Browse files

Merge branch 'master' into 'master'

Revision3

See merge request pycodegen/pystencils!295
parents f38af3f3 b9d654ae
Branches master
No related merge requests found
Pipeline #40425 passed with stages
in 18 minutes and 20 seconds
......@@ -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):
......
......@@ -25,7 +25,9 @@ def test_symbol_renaming():
loops = block.atoms(LoopOverCoordinate)
assert len(loops) == 2
assert len(block.args[2].body.args) == 1
assert len(block.args[3].body.args) == 2
for loop in loops:
assert len(loop.body.args) == 1
assert len(loop.parent.args) == 4 # 2 loops + 2 subexpressions
assert loop.parent.args[0].lhs.name != loop.parent.args[1].lhs.name
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment