CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
150 lines
6.9 KiB
Plaintext
150 lines
6.9 KiB
Plaintext
// Use --mlir-disable-threading so that the AA queries are serialized
|
|
// as well as its diagnostic output.
|
|
// RUN: fir-opt %s -pass-pipeline='builtin.module(func.func(test-fir-alias-analysis))' -split-input-file --mlir-disable-threading 2>&1 | FileCheck %s
|
|
|
|
// module m
|
|
// type t
|
|
// real, pointer :: pointer_component
|
|
// end type t
|
|
// type(t) :: a
|
|
// contains
|
|
// subroutine test(pointer_dummy, x)
|
|
// real, pointer :: pointer_dummy
|
|
// real, target :: x
|
|
// pointer_dummy => x
|
|
// call test2(a%pointer_component)
|
|
// end subroutine test
|
|
// end module m
|
|
|
|
// A composite with a pointer component may alias with a dummy pointer
|
|
// CHECK-LABEL: Testing : "_QMmPtest
|
|
// CHECK: a#0 <-> func.region0#0: MayAlias
|
|
|
|
// a's box cannot alias with raw reference to f32 (x)
|
|
// CHECK: a#0 <-> func.region0#1: NoAlias
|
|
|
|
// pointer_dummy's box cannot alias with raw reference to f32 (x)
|
|
// CHECK: func.region0#0 <-> func.region0#1: NoAlias
|
|
|
|
fir.global @_QMmEa : !fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}> {
|
|
%0 = fir.undefined !fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>
|
|
fir.has_value %0 : !fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>
|
|
}
|
|
func.func @_QMmPtest(%arg0: !fir.ref<!fir.box<!fir.ptr<f32>>> {fir.bindc_name = "pointer_dummy"}, %arg1: !fir.ref<f32> {fir.bindc_name = "x", fir.target}) attributes {test.ptr = "func"} {
|
|
%0 = fir.address_of(@_QMmEa) {test.ptr = "a"} : !fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>>
|
|
%1 = fir.embox %arg1 : (!fir.ref<f32>) -> !fir.box<!fir.ptr<f32>>
|
|
fir.store %1 to %arg0 : !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%3 = fir.coordinate_of %0, pointer_component : (!fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>>) -> !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%4 = fir.load %3 : !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%5 = fir.box_addr %4 : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
|
|
%6 = fir.convert %5 : (!fir.ptr<f32>) -> !fir.ref<f32>
|
|
fir.call @_QPtest2(%6) fastmath<contract> : (!fir.ref<f32>) -> ()
|
|
return
|
|
}
|
|
func.func private @_QPtest2(!fir.ref<f32>)
|
|
|
|
// -----
|
|
|
|
// A composite with a pointer component does not alias with a dummy
|
|
// argument of composite type with a pointer component:
|
|
// module m
|
|
// type t
|
|
// real, pointer :: pointer_component
|
|
// end type t
|
|
// type(t) :: a
|
|
// contains
|
|
// subroutine test(b, x)
|
|
// type(t) :: b
|
|
// real, target :: x
|
|
// a%pointer_component => x
|
|
// call test2(b%pointer_component)
|
|
// end subroutine test
|
|
// end module m
|
|
|
|
// CHECK-LABEL: Testing : "_QMmPtest"
|
|
// CHECK: a#0 <-> func.region0#0: NoAlias
|
|
|
|
fir.global @_QMmEa : !fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}> {
|
|
%0 = fir.undefined !fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>
|
|
fir.has_value %0 : !fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>
|
|
}
|
|
func.func @_QMmPtest(%arg0: !fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>> {fir.bindc_name = "b"}, %arg1: !fir.ref<f32> {fir.bindc_name = "x", fir.target}) attributes {test.ptr = "func"} {
|
|
%0 = fir.address_of(@_QMmEa) {test.ptr = "a"} : !fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>>
|
|
%2 = fir.coordinate_of %0, pointer_component : (!fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>>) -> !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%3 = fir.embox %arg1 : (!fir.ref<f32>) -> !fir.box<!fir.ptr<f32>>
|
|
fir.store %3 to %2 : !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%5 = fir.coordinate_of %arg0, pointer_component : (!fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>>) -> !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%6 = fir.load %5 : !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%7 = fir.box_addr %6 : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
|
|
%8 = fir.convert %7 : (!fir.ptr<f32>) -> !fir.ref<f32>
|
|
fir.call @_QPtest2(%8) fastmath<contract> : (!fir.ref<f32>) -> ()
|
|
return
|
|
}
|
|
func.func private @_QPtest2(!fir.ref<f32>)
|
|
|
|
// -----
|
|
|
|
// Two dummy arguments of composite type with a pointer component
|
|
// do not alias each other:
|
|
// module m
|
|
// type t
|
|
// real, pointer :: pointer_component
|
|
// end type t
|
|
// contains
|
|
// subroutine test(a, b, x)
|
|
// type(t) :: a, b
|
|
// real, target :: x
|
|
// a%pointer_component => x
|
|
// call test2(b%pointer_component)
|
|
// end subroutine test
|
|
// end module m
|
|
|
|
// CHECK-LABEL: Testing : "_QMmPtest"
|
|
// CHECK: func.region0#0 <-> func.region0#1: NoAlias
|
|
|
|
func.func @_QMmPtest(%arg0: !fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>> {fir.bindc_name = "a"}, %arg1: !fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>> {fir.bindc_name = "b"}, %arg2: !fir.ref<f32> {fir.bindc_name = "x", fir.target}) attributes {test.ptr = "func"} {
|
|
%1 = fir.coordinate_of %arg0, pointer_component : (!fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>>) -> !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%2 = fir.embox %arg2 : (!fir.ref<f32>) -> !fir.box<!fir.ptr<f32>>
|
|
fir.store %2 to %1 : !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%4 = fir.coordinate_of %arg1, pointer_component : (!fir.ref<!fir.type<_QMmTt{pointer_component:!fir.box<!fir.ptr<f32>>}>>) -> !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%5 = fir.load %4 : !fir.ref<!fir.box<!fir.ptr<f32>>>
|
|
%6 = fir.box_addr %5 : (!fir.box<!fir.ptr<f32>>) -> !fir.ptr<f32>
|
|
%7 = fir.convert %6 : (!fir.ptr<f32>) -> !fir.ref<f32>
|
|
fir.call @_QPtest2(%7) fastmath<contract> : (!fir.ref<f32>) -> ()
|
|
return
|
|
}
|
|
func.func private @_QPtest2(!fir.ref<f32>)
|
|
|
|
// -----
|
|
|
|
// Two dummy arguments of composite type consisting of an allocatable
|
|
// component cannot alias:
|
|
// module m
|
|
// type t
|
|
// real, allocatable :: allocatable_component
|
|
// end type t
|
|
// contains
|
|
// subroutine test(a, b)
|
|
// type(t) :: a, b
|
|
// allocate(a%allocatable_component)
|
|
// call test2(b%allocatable_component)
|
|
// end subroutine test
|
|
// end module m
|
|
|
|
// CHECK-LABEL: Testing : "_QMmPtest"
|
|
// CHECK: func.region0#0 <-> func.region0#1: NoAlias
|
|
|
|
func.func @_QMmPtest(%arg0: !fir.ref<!fir.type<_QMmTt{allocatable_component:!fir.box<!fir.heap<f32>>}>> {fir.bindc_name = "a"}, %arg1: !fir.ref<!fir.type<_QMmTt{allocatable_component:!fir.box<!fir.heap<f32>>}>> {fir.bindc_name = "b"}) attributes {test.ptr = "func"} {
|
|
%1 = fir.coordinate_of %arg0, allocatable_component : (!fir.ref<!fir.type<_QMmTt{allocatable_component:!fir.box<!fir.heap<f32>>}>>) -> !fir.ref<!fir.box<!fir.heap<f32>>>
|
|
%2 = fir.allocmem f32 {uniq_name = "_QMmEallocatable_component.alloc"}
|
|
%3 = fir.embox %2 : (!fir.heap<f32>) -> !fir.box<!fir.heap<f32>>
|
|
fir.store %3 to %1 : !fir.ref<!fir.box<!fir.heap<f32>>>
|
|
%5 = fir.coordinate_of %arg1, allocatable_component : (!fir.ref<!fir.type<_QMmTt{allocatable_component:!fir.box<!fir.heap<f32>>}>>) -> !fir.ref<!fir.box<!fir.heap<f32>>>
|
|
%6 = fir.load %5 : !fir.ref<!fir.box<!fir.heap<f32>>>
|
|
%7 = fir.box_addr %6 : (!fir.box<!fir.heap<f32>>) -> !fir.heap<f32>
|
|
%8 = fir.convert %7 : (!fir.heap<f32>) -> !fir.ref<f32>
|
|
fir.call @_QPtest2(%8) fastmath<contract> : (!fir.ref<f32>) -> ()
|
|
return
|
|
}
|
|
func.func private @_QPtest2(!fir.ref<f32>)
|