[llvm-branch-commits] [flang] [flang] handle fir.call in AliasAnalysis::getModRef (PR #117164)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 22 06:21:15 PST 2024


================
@@ -0,0 +1,135 @@
+! RUN: bbc -emit-hlfir %s -o - | %python %S/gen_mod_ref_test.py | \
+! RUN:  fir-opt -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis-modref))' \
+! RUN:  --mlir-disable-threading -o /dev/null 2>&1 | FileCheck %s
+
+! Test fir.call modref with internal procedures
+
+subroutine simple_modref_test(test_var_x)
+  implicit none
+  real :: test_var_x
+  call test_effect_internal()
+contains
+  subroutine test_effect_internal()
+    test_var_x = 0.
+  end subroutine
+end subroutine
+! CHECK-LABEL: Testing : "_QPsimple_modref_test"
+! CHECK: test_effect_internal -> test_var_x#0: ModRef
+
+subroutine simple_nomodref_test(test_var_x)
+  implicit none
+  real :: test_var_x
+  call test_effect_internal()
+contains
+  subroutine test_effect_internal()
+    call some_external()
+  end subroutine
+end subroutine
+! CHECK-LABEL: Testing : "_QPsimple_nomodref_test"
+! CHECK: test_effect_internal -> test_var_x#0: NoModRef
+
+! Test that effects on captured variable are propagated to associated variables
+! in associate construct.
+
+subroutine test_associate()
+  implicit none
+  real :: test_var_x(10)
+  associate (test_var_y=>test_var_x)
+    test_var_y = test_effect_internal()
----------------
jeanPerier wrote:

No it is not necessary. I changed the test as suggested.

https://github.com/llvm/llvm-project/pull/117164


More information about the llvm-branch-commits mailing list