From ce64ce949e0af4d98c0812fe535ad757906223a2 Mon Sep 17 00:00:00 2001 From: Joe Wallwork Date: Wed, 23 Oct 2024 16:52:31 +0100 Subject: [PATCH] #2717: Use is_parallelisable method in loop tests --- src/psyclone/tests/psyir/nodes/loop_test.py | 4 ++++ src/psyclone/tests/psyir/tools/dependency_tools_test.py | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/psyclone/tests/psyir/nodes/loop_test.py b/src/psyclone/tests/psyir/nodes/loop_test.py index f4d5f93482..e0bff06d60 100644 --- a/src/psyclone/tests/psyir/nodes/loop_test.py +++ b/src/psyclone/tests/psyir/nodes/loop_test.py @@ -35,6 +35,7 @@ # I. Kavcic, Met Office # J. Henrichs, Bureau of Meteorology # Modified by L. Turner, Met Office +# Modified J. G. Wallwork, University of Cambridge # ----------------------------------------------------------------------------- ''' Performs py.test tests on the Loop PSyIR node. ''' @@ -590,3 +591,6 @@ def test_loop_type(fortran_reader): Loop.set_loop_type_inference_rules(None) assert outer_loop.loop_type is None assert inner_loop.loop_type is None + + assert outer_loop.is_parallelisable + assert inner_loop.is_parallelisable diff --git a/src/psyclone/tests/psyir/tools/dependency_tools_test.py b/src/psyclone/tests/psyir/tools/dependency_tools_test.py index 49a85611fb..210c43d1e4 100644 --- a/src/psyclone/tests/psyir/tools/dependency_tools_test.py +++ b/src/psyclone/tests/psyir/tools/dependency_tools_test.py @@ -441,7 +441,8 @@ def test_array_access_pairs_multi_var(lhs, rhs, independent, fortran_reader): ]) def test_improved_dependency_analysis(lhs, rhs, is_parallelisable, fortran_reader): - '''Tests the array checks of can_loop_be_parallelised. + '''Tests the array checks of can_loop_be_parallelised as called via the + is_parallelisable method of the Loop node. ''' source = f'''program test integer j, k, d_k @@ -458,8 +459,7 @@ def test_improved_dependency_analysis(lhs, rhs, is_parallelisable, end program test''' psyir = fortran_reader.psyir_from_source(source) loop = psyir.children[0].children[0] - dep_tools = DependencyTools() - result = dep_tools.can_loop_be_parallelised(loop) + result = loop.is_parallelisable assert result is is_parallelisable