From 5d7e7b34b4168e16e083906fb5d82cd9ed4b2905 Mon Sep 17 00:00:00 2001 From: Michael Staneker Date: Tue, 8 Oct 2024 15:49:29 +0200 Subject: [PATCH] Function inlining: minor changes/improvements --- loki/transformations/inline.py | 5 +++-- loki/transformations/tests/test_inline.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/loki/transformations/inline.py b/loki/transformations/inline.py index 919dd9b22..d77aa56f6 100644 --- a/loki/transformations/inline.py +++ b/loki/transformations/inline.py @@ -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) @@ -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` @@ -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()] diff --git a/loki/transformations/tests/test_inline.py b/loki/transformations/tests/test_inline.py index d3bdf02ca..a9eafb061 100644 --- a/loki/transformations/tests/test_inline.py +++ b/loki/transformations/tests/test_inline.py @@ -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