Skip to content

Commit 4d3ed3d

Browse files
authored
Merge pull request #3161 from stfc/3155_reduce_InlineTrans_copy
(Closes #3155) Optimise InlineTrans so that it only copies target Routine
2 parents a3df94c + 90de7ad commit 4d3ed3d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

changelog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
99) PR #3161 for #3155. Optimise InlineTrans to only to a copy of the
2+
target routine instead of the whole Container.
3+
14
98) PR #3110 for #3087. Add support for declaration kind expressions by
25
representing them with a PSyIR tree.
36

src/psyclone/psyir/transformations/inline_trans.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,15 @@ def apply(self, node, options=None):
153153

154154
# Ensure we don't modify the original Routine by working with a
155155
# copy of it.
156-
container = orig_routine.ancestor(Container).copy()
157-
routine = container.find_routine_psyir(orig_routine.name,
158-
allow_private=True)
156+
routine = orig_routine.copy()
159157
routine_table = routine.symbol_table
160158

161159
# Construct lists of the nodes that will be inserted and all of the
162160
# References that they contain.
163161
new_stmts = []
164162
refs = []
165-
for child in routine.children:
166-
new_stmts.append(child.copy())
163+
for child in routine.pop_all_children():
164+
new_stmts.append(child)
167165
refs.extend(new_stmts[-1].walk(Reference))
168166

169167
# Shallow copy the symbols from the routine into the table at the

0 commit comments

Comments
 (0)