================ @@ -0,0 +1,68 @@ +! 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 for global variables (module, saved, common). + + +module somemod + implicit none + real :: test_var_xmod + interface + subroutine may_capture(x) + real, target :: x + end subroutine + end interface +end module + +subroutine test_module + use somemod, only : test_var_xmod + implicit none + call test_effect_external() +end subroutine +! CHECK-LABEL: Testing : "_QPtest_module" +! CHECK: test_effect_external -> test_var_xmod#0: ModRef + +subroutine test_saved_local + use somemod, only : may_capture + implicit none + real, save :: test_var_xsaved + ! Capture is invalid after the call because test_var_xsaved does not have the + ! target attribute. + call may_capture(test_var_xsaved) + call test_effect_external() +end subroutine +! CHECK-LABEL: Testing : "_QPtest_saved_local" +! CHECK: test_effect_external -> test_var_xsaved#0: NoModRef + +subroutine test_saved_target + use somemod, only : may_capture + implicit none + real, save, target :: test_var_target_xsaved ---------------- klausler wrote:
The 'save' attribute shouldn't matter; the result would be ModRef with and without `save`, yes? https://github.com/llvm/llvm-project/pull/117164 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits