Skip to content

Commit

Permalink
Function inlining: minor changes/improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSt98 authored and reuterbal committed Oct 9, 2024
1 parent 048c2a0 commit cf1b03c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions loki/transformations/inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ class FindInlineCallsSkipInlineCallParameters(ExpressionFinder):
# inline functions
node_prepend_map = {}
call_map = {}
for _, calls_nodes in function_calls.items():
for calls_nodes in function_calls.values():
calls, nodes = list(zip(*calls_nodes))
for call in calls:
removed_functions.add(call.procedure_type)
Expand Down Expand Up @@ -702,6 +702,7 @@ def inline_function_calls(routine, calls, callee, nodes, allowed_aliases=None):
routine : :any:`Subroutine`
The subroutine in which to inline all calls to the member routine
calls : tuple or list of :any:`InlineCall`
Set of calls (to the same callee) to be inlined.
callee : :any:`Subroutine`
The called target function to be inlined in the parent
nodes : :any:`Node`
Expand All @@ -711,7 +712,7 @@ def inline_function_calls(routine, calls, callee, nodes, allowed_aliases=None):
if they alias with a local declaration.
"""

def rename_result_name(routine, rename=''):
def rename_result_name(routine, rename):
callee = routine.clone()
var_map = {}
callee_result_var = callee.variable_map[callee.result_name.lower()]
Expand Down
3 changes: 2 additions & 1 deletion loki/transformations/tests/test_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,14 @@ def test_inline_member_routines(tmp_path, frontend):


@pytest.mark.parametrize('frontend', available_frontends(skip={
OMNI: "OMNI can't parse the code"}))
OMNI: "OMNI has a problem with function return variables being arrays!"}))
def test_inline_member_functions(tmp_path, frontend):
"""
Test inlining of member subroutines.
"""
fcode = """
subroutine member_functions(a, b, c)
implicit none
real(kind=8), intent(inout) :: a(3), b(3), c(3)
integer :: i
Expand Down

0 comments on commit cf1b03c

Please sign in to comment.