| 1 |
// RUN: fir-opt --fir-add-alias-tags %s | FileCheck --check-prefixes=ALL,DEFAULT %s |
| 2 |
// RUN: fir-opt --fir-add-alias-tags --local-alloc-tbaa %s | FileCheck --check-prefixes=ALL,LOCAL %s |
| 3 |
|
| 4 |
// Test AddAliasTagsPass creating sub-tree for TARGET/POINTER variables. |
| 5 |
|
| 6 |
// module data |
| 7 |
// real :: glob(10) |
| 8 |
// real, target :: globt(10) |
| 9 |
// real, allocatable :: globa(:) |
| 10 |
// real, allocatable, target :: globat(:) |
| 11 |
// real, pointer :: globp(:) |
| 12 |
// end module data |
| 13 |
// subroutine test1(dummyf, dummyft, dummyas, dummyast, dummya, dummyat, dummyp) |
| 14 |
// use data |
| 15 |
// real :: dummyf(10) |
| 16 |
// real, target :: dummyft(10) |
| 17 |
// real :: dummyas(:) |
| 18 |
// real, target :: dummyast(:) |
| 19 |
// real, allocatable :: dummya(:) |
| 20 |
// real, allocatable, target :: dummyat(:) |
| 21 |
// real, pointer :: dummyp(:) |
| 22 |
// real :: local(10) |
| 23 |
// real, target :: localt(10) |
| 24 |
// real, allocatable :: locala(:) |
| 25 |
// real, allocatable, target :: localat(:) |
| 26 |
// real, pointer :: localp(:) |
| 27 |
// glob(1) = 1.0 |
| 28 |
// globt(1) = 1.0 |
| 29 |
// globa(1) = 1.0 |
| 30 |
// globat(1) = 1.0 |
| 31 |
// globp(1) = 1.0 |
| 32 |
// dummyf(1) = 1.0 |
| 33 |
// dummyft(1) = 1.0 |
| 34 |
// dummyas(1) = 1.0 |
| 35 |
// dummyast(1) = 1.0 |
| 36 |
// dummya(1) = 1.0 |
| 37 |
// dummyat(1) = 1.0 |
| 38 |
// dummyp(1) = 1.0 |
| 39 |
// local(1) = 1.0 |
| 40 |
// localt(1) = 1.0 |
| 41 |
// locala(1) = 1.0 |
| 42 |
// localat(1) = 1.0 |
| 43 |
// localp(1) = 1.0 |
| 44 |
// end subroutine test1 |
| 45 |
|
| 46 |
// "Flang function root _QPtest1" |
| 47 |
// | |
| 48 |
// "any access" |
| 49 |
// | |
| 50 |
// |- "descriptor member" |
| 51 |
// |- "any data access" |
| 52 |
// | |
| 53 |
// |- "dummy arg data" |
| 54 |
// | | |
| 55 |
// | |- "dummy arg data/_QFtest1Edummyf" |
| 56 |
// | |- "dummy arg data/_QFtest1Edummyas" |
| 57 |
// | |- "dummy arg data/_QFtest1Edummya" |
| 58 |
// | |
| 59 |
// |- "target data" <- all pointers and taget dummys |
| 60 |
// | |
| 61 |
// |- "global data" |
| 62 |
// | | |
| 63 |
// | |- "global data/_QMdataEglob" |
| 64 |
// | |- "global data/_QMdataEglobt" |
| 65 |
// | |
| 66 |
// |- "direct data" |
| 67 |
// | | |
| 68 |
// | |- "direct data/_QMdataEgloba" |
| 69 |
// | |- "direct data/_QMdataEglobat" |
| 70 |
// | |
| 71 |
// |- "allocated data" |
| 72 |
// | |
| 73 |
// |- "allocated data/_QFtest1Elocal" |
| 74 |
// |- "allocated data/_QFtest1Elocalt" |
| 75 |
// |- "allocated data/_QFtest1Elocala" |
| 76 |
// |- "allocated data/_QFtest1Elocalat" |
| 77 |
|
| 78 |
// ALL: #[[FUNCROOT:.+]] = #llvm.tbaa_root<id = "Flang function root _QPtest1"> |
| 79 |
// ALL: #[[ANYACCESS:.+]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[FUNCROOT]], 0>}> |
| 80 |
// ALL: #[[ANYDATA:.+]] = #llvm.tbaa_type_desc<id = "any data access", members = {<#[[ANYACCESS]], 0>}> |
| 81 |
// ALL: #[[TARGETDATA:.+]] = #llvm.tbaa_type_desc<id = "target data", members = {<#[[ANYDATA]], 0>}> |
| 82 |
// ALL: #[[DUMMYDATA:.+]] = #llvm.tbaa_type_desc<id = "dummy arg data", members = {<#[[ANYDATA]], 0>}> |
| 83 |
// ALL: #[[TARGETTAG:.+]] = #llvm.tbaa_tag<base_type = #[[TARGETDATA]], access_type = #[[TARGETDATA]], offset = 0> |
| 84 |
// ALL: #[[GLOBALDATA:.+]] = #llvm.tbaa_type_desc<id = "global data", members = {<#[[TARGETDATA]], 0>}> |
| 85 |
// ALL: #[[DIRECTDATA:.+]] = #llvm.tbaa_type_desc<id = "direct data", members = {<#[[TARGETDATA]], 0>}> |
| 86 |
// ALL: #[[DUMMYFVAR:.+]] = #llvm.tbaa_type_desc<id = "dummy arg data/_QFtest1Edummyf", members = {<#[[DUMMYDATA]], 0>}> |
| 87 |
// ALL: #[[DUMMYASVAR:.+]] = #llvm.tbaa_type_desc<id = "dummy arg data/_QFtest1Edummyas", members = {<#[[DUMMYDATA]], 0>}> |
| 88 |
// ALL: #[[DUMMYAVAR:.+]] = #llvm.tbaa_type_desc<id = "dummy arg data/_QFtest1Edummya", members = {<#[[DUMMYDATA]], 0>}> |
| 89 |
// LOCAL: #[[LOCALDATA:.+]] = #llvm.tbaa_type_desc<id = "allocated data", members = {<#[[TARGETDATA]], 0>}> |
| 90 |
// ALL: #[[DUMMYFTAG:.+]] = #llvm.tbaa_tag<base_type = #[[DUMMYFVAR]], access_type = #[[DUMMYFVAR]], offset = 0> |
| 91 |
// ALL: #[[DUMMYASTAG:.+]] = #llvm.tbaa_tag<base_type = #[[DUMMYASVAR]], access_type = #[[DUMMYASVAR]], offset = 0> |
| 92 |
// ALL: #[[DUMMYATAG:.+]] = #llvm.tbaa_tag<base_type = #[[DUMMYAVAR]], access_type = #[[DUMMYAVAR]], offset = 0> |
| 93 |
// ALL: #[[GLOBVAR:.+]] = #llvm.tbaa_type_desc<id = "global data/_QMdataEglob", members = {<#[[GLOBALDATA]], 0>}> |
| 94 |
// ALL: #[[GLOBTVAR:.+]] = #llvm.tbaa_type_desc<id = "global data/_QMdataEglobt", members = {<#[[GLOBALDATA]], 0>}> |
| 95 |
// ALL: #[[GLOBAVAR:.+]] = #llvm.tbaa_type_desc<id = "direct data/_QMdataEgloba", members = {<#[[DIRECTDATA]], 0>}> |
| 96 |
// ALL: #[[GLOBATVAR:.+]] = #llvm.tbaa_type_desc<id = "direct data/_QMdataEglobat", members = {<#[[DIRECTDATA]], 0>}> |
| 97 |
// LOCAL: #[[LOCALVAR:.+]] = #llvm.tbaa_type_desc<id = "allocated data/_QFtest1Elocal", members = {<#[[LOCALDATA]], 0>}> |
| 98 |
// LOCAL: #[[LOCALTVAR:.+]] = #llvm.tbaa_type_desc<id = "allocated data/_QFtest1Elocalt", members = {<#[[LOCALDATA]], 0>}> |
| 99 |
// LOCAL: #[[LOCALAVAR:.+]] = #llvm.tbaa_type_desc<id = "allocated data/_QFtest1Elocala", members = {<#[[LOCALDATA]], 0>}> |
| 100 |
// LOCAL: #[[LOCALATVAR:.+]] = #llvm.tbaa_type_desc<id = "allocated data/_QFtest1Elocalat", members = {<#[[LOCALDATA]], 0>}> |
| 101 |
// ALL: #[[GLOBTAG:.+]] = #llvm.tbaa_tag<base_type = #[[GLOBVAR]], access_type = #[[GLOBVAR]], offset = 0> |
| 102 |
// ALL: #[[GLOBTTAG:.+]] = #llvm.tbaa_tag<base_type = #[[GLOBTVAR]], access_type = #[[GLOBTVAR]], offset = 0> |
| 103 |
// ALL: #[[GLOBATAG:.+]] = #llvm.tbaa_tag<base_type = #[[GLOBAVAR]], access_type = #[[GLOBAVAR]], offset = 0> |
| 104 |
// ALL: #[[GLOBATTAG:.+]] = #llvm.tbaa_tag<base_type = #[[GLOBATVAR]], access_type = #[[GLOBATVAR]], offset = 0> |
| 105 |
// LOCAL: #[[LOCALTAG:.+]] = #llvm.tbaa_tag<base_type = #[[LOCALVAR]], access_type = #[[LOCALVAR]], offset = 0> |
| 106 |
// LOCAL: #[[LOCALTTAG:.+]] = #llvm.tbaa_tag<base_type = #[[LOCALTVAR]], access_type = #[[LOCALTVAR]], offset = 0> |
| 107 |
// LOCAL: #[[LOCALATAG:.+]] = #llvm.tbaa_tag<base_type = #[[LOCALAVAR]], access_type = #[[LOCALAVAR]], offset = 0> |
| 108 |
// LOCAL: #[[LOCALATTAG:.+]] = #llvm.tbaa_tag<base_type = #[[LOCALATVAR]], access_type = #[[LOCALATVAR]], offset = 0> |
| 109 |
|
| 110 |
module { |
| 111 |
fir.global @_QMdataEglob : !fir.array<10xf32> { |
| 112 |
%0 = fir.zero_bits !fir.array<10xf32> |
| 113 |
fir.has_value %0 : !fir.array<10xf32> |
| 114 |
} |
| 115 |
fir.global @_QMdataEgloba : !fir.box<!fir.heap<!fir.array<?xf32>>> { |
| 116 |
%c0 = arith.constant 0 : index |
| 117 |
%0 = fir.zero_bits !fir.heap<!fir.array<?xf32>> |
| 118 |
%1 = fir.shape %c0 : (index) -> !fir.shape<1> |
| 119 |
%2 = fir.embox %0(%1) : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.heap<!fir.array<?xf32>>> |
| 120 |
fir.has_value %2 : !fir.box<!fir.heap<!fir.array<?xf32>>> |
| 121 |
} |
| 122 |
fir.global @_QMdataEglobat target : !fir.box<!fir.heap<!fir.array<?xf32>>> { |
| 123 |
%c0 = arith.constant 0 : index |
| 124 |
%0 = fir.zero_bits !fir.heap<!fir.array<?xf32>> |
| 125 |
%1 = fir.shape %c0 : (index) -> !fir.shape<1> |
| 126 |
%2 = fir.embox %0(%1) : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.heap<!fir.array<?xf32>>> |
| 127 |
fir.has_value %2 : !fir.box<!fir.heap<!fir.array<?xf32>>> |
| 128 |
} |
| 129 |
fir.global @_QMdataEglobp : !fir.box<!fir.ptr<!fir.array<?xf32>>> { |
| 130 |
%c0 = arith.constant 0 : index |
| 131 |
%0 = fir.zero_bits !fir.ptr<!fir.array<?xf32>> |
| 132 |
%1 = fir.shape %c0 : (index) -> !fir.shape<1> |
| 133 |
%2 = fir.embox %0(%1) : (!fir.ptr<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.ptr<!fir.array<?xf32>>> |
| 134 |
fir.has_value %2 : !fir.box<!fir.ptr<!fir.array<?xf32>>> |
| 135 |
} |
| 136 |
fir.global @_QMdataEglobt target : !fir.array<10xf32> { |
| 137 |
%0 = fir.zero_bits !fir.array<10xf32> |
| 138 |
fir.has_value %0 : !fir.array<10xf32> |
| 139 |
} |
| 140 |
|
| 141 |
// ALL-LABEL: func.func @_QPtest1( |
| 142 |
func.func @_QPtest1(%arg0: !fir.ref<!fir.array<10xf32>> {fir.bindc_name = "dummyf"}, %arg1: !fir.ref<!fir.array<10xf32>> {fir.bindc_name = "dummyft", fir.target}, %arg2: !fir.box<!fir.array<?xf32>> {fir.bindc_name = "dummyas"}, %arg3: !fir.box<!fir.array<?xf32>> {fir.bindc_name = "dummyast", fir.target}, %arg4: !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> {fir.bindc_name = "dummya"}, %arg5: !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> {fir.bindc_name = "dummyat", fir.target}, %arg6: !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> {fir.bindc_name = "dummyp"}) { |
| 143 |
%c0_i64 = arith.constant 0 : i64 |
| 144 |
%c1 = arith.constant 1 : index |
| 145 |
%cst = arith.constant 1.000000e+00 : f32 |
| 146 |
%c0 = arith.constant 0 : index |
| 147 |
%c10 = arith.constant 10 : index |
| 148 |
%0 = fir.dummy_scope : !fir.dscope |
| 149 |
%1 = fir.declare %arg4 dummy_scope %0 {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest1Edummya"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.dscope) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 150 |
%2 = fir.declare %arg2 dummy_scope %0 {uniq_name = "_QFtest1Edummyas"} : (!fir.box<!fir.array<?xf32>>, !fir.dscope) -> !fir.box<!fir.array<?xf32>> |
| 151 |
%3 = fir.declare %arg3 dummy_scope %0 {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFtest1Edummyast"} : (!fir.box<!fir.array<?xf32>>, !fir.dscope) -> !fir.box<!fir.array<?xf32>> |
| 152 |
%4 = fir.declare %arg5 dummy_scope %0 {fortran_attrs = #fir.var_attrs<allocatable, target>, uniq_name = "_QFtest1Edummyat"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.dscope) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 153 |
%5 = fir.shape %c10 : (index) -> !fir.shape<1> |
| 154 |
%6 = fir.declare %arg0(%5) dummy_scope %0 {uniq_name = "_QFtest1Edummyf"} : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>, !fir.dscope) -> !fir.ref<!fir.array<10xf32>> |
| 155 |
%7 = fir.declare %arg1(%5) dummy_scope %0 {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFtest1Edummyft"} : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>, !fir.dscope) -> !fir.ref<!fir.array<10xf32>> |
| 156 |
%8 = fir.declare %arg6 dummy_scope %0 {fortran_attrs = #fir.var_attrs<pointer>, uniq_name = "_QFtest1Edummyp"} : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, !fir.dscope) -> !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> |
| 157 |
%9 = fir.address_of(@_QMdataEglob) : !fir.ref<!fir.array<10xf32>> |
| 158 |
%10 = fir.declare %9(%5) {uniq_name = "_QMdataEglob"} : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>) -> !fir.ref<!fir.array<10xf32>> |
| 159 |
%11 = fir.address_of(@_QMdataEgloba) : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 160 |
%12 = fir.declare %11 {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QMdataEgloba"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 161 |
%13 = fir.address_of(@_QMdataEglobat) : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 162 |
%14 = fir.declare %13 {fortran_attrs = #fir.var_attrs<allocatable, target>, uniq_name = "_QMdataEglobat"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 163 |
%15 = fir.address_of(@_QMdataEglobp) : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> |
| 164 |
%16 = fir.declare %15 {fortran_attrs = #fir.var_attrs<pointer>, uniq_name = "_QMdataEglobp"} : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> |
| 165 |
%17 = fir.address_of(@_QMdataEglobt) : !fir.ref<!fir.array<10xf32>> |
| 166 |
%18 = fir.declare %17(%5) {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QMdataEglobt"} : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>) -> !fir.ref<!fir.array<10xf32>> |
| 167 |
%19 = fir.alloca !fir.array<10xf32> {bindc_name = "local", uniq_name = "_QFtest1Elocal"} |
| 168 |
%20 = fir.declare %19(%5) {uniq_name = "_QFtest1Elocal"} : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>) -> !fir.ref<!fir.array<10xf32>> |
| 169 |
%21 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "locala", uniq_name = "_QFtest1Elocala"} |
| 170 |
%22 = fir.zero_bits !fir.heap<!fir.array<?xf32>> |
| 171 |
%23 = fir.shape %c0 : (index) -> !fir.shape<1> |
| 172 |
%24 = fir.embox %22(%23) : (!fir.heap<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.heap<!fir.array<?xf32>>> |
| 173 |
// ALL-NOT: fir.store{{.*}}tbaa |
| 174 |
fir.store %24 to %21 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 175 |
%25 = fir.declare %21 {fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFtest1Elocala"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 176 |
%26 = fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "localat", fir.target, uniq_name = "_QFtest1Elocalat"} |
| 177 |
// ALL-NOT: fir.store{{.*}}tbaa |
| 178 |
fir.store %24 to %26 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 179 |
%27 = fir.declare %26 {fortran_attrs = #fir.var_attrs<allocatable, target>, uniq_name = "_QFtest1Elocalat"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 180 |
%28 = fir.alloca !fir.box<!fir.ptr<!fir.array<?xf32>>> {bindc_name = "localp", uniq_name = "_QFtest1Elocalp"} |
| 181 |
%29 = fir.zero_bits !fir.ptr<!fir.array<?xf32>> |
| 182 |
%30 = fir.embox %29(%23) : (!fir.ptr<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.ptr<!fir.array<?xf32>>> |
| 183 |
// ALL-NOT: fir.store{{.*}}tbaa |
| 184 |
fir.store %30 to %28 : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> |
| 185 |
%31 = fir.declare %28 {fortran_attrs = #fir.var_attrs<pointer>, uniq_name = "_QFtest1Elocalp"} : (!fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> |
| 186 |
%32 = fir.alloca !fir.array<10xf32> {bindc_name = "localt", fir.target, uniq_name = "_QFtest1Elocalt"} |
| 187 |
%33 = fir.declare %32(%5) {fortran_attrs = #fir.var_attrs<target>, uniq_name = "_QFtest1Elocalt"} : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>) -> !fir.ref<!fir.array<10xf32>> |
| 188 |
%34 = fir.array_coor %10(%5) %c1 : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>, index) -> !fir.ref<f32> |
| 189 |
// module data :: real :: glob(10) |
| 190 |
// ALL: fir.store{{.*}}{tbaa = [#[[GLOBTAG]]]} : !fir.ref<f32> |
| 191 |
fir.store %cst to %34 : !fir.ref<f32> |
| 192 |
%35 = fir.array_coor %18(%5) %c1 : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>, index) -> !fir.ref<f32> |
| 193 |
// module data :: real, target :: globt(10) |
| 194 |
// ALL: fir.store{{.*}}{tbaa = [#[[GLOBTTAG]]]} : !fir.ref<f32> |
| 195 |
fir.store %cst to %35 : !fir.ref<f32> |
| 196 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 197 |
%36 = fir.load %12 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 198 |
%37 = fir.box_addr %36 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 199 |
%38:3 = fir.box_dims %36, %c0 : (!fir.box<!fir.heap<!fir.array<?xf32>>>, index) -> (index, index, index) |
| 200 |
%39 = fir.shape_shift %38#0, %38#1 : (index, index) -> !fir.shapeshift<1> |
| 201 |
%40 = fir.array_coor %37(%39) %c1 : (!fir.heap<!fir.array<?xf32>>, !fir.shapeshift<1>, index) -> !fir.ref<f32> |
| 202 |
// module data :: real, allocatable :: globa(:) |
| 203 |
// ALL: fir.store{{.*}}{tbaa = [#[[GLOBATAG]]]} : !fir.ref<f32> |
| 204 |
fir.store %cst to %40 : !fir.ref<f32> |
| 205 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 206 |
%41 = fir.load %14 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 207 |
%42 = fir.box_addr %41 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 208 |
%43:3 = fir.box_dims %41, %c0 : (!fir.box<!fir.heap<!fir.array<?xf32>>>, index) -> (index, index, index) |
| 209 |
%44 = fir.shape_shift %43#0, %43#1 : (index, index) -> !fir.shapeshift<1> |
| 210 |
%45 = fir.array_coor %42(%44) %c1 : (!fir.heap<!fir.array<?xf32>>, !fir.shapeshift<1>, index) -> !fir.ref<f32> |
| 211 |
// module data :: real, allocatable, target :: globat(:) |
| 212 |
// ALL: fir.store{{.*}}{tbaa = [#[[GLOBATTAG]]]} : !fir.ref<f32> |
| 213 |
fir.store %cst to %45 : !fir.ref<f32> |
| 214 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 215 |
%46 = fir.load %16 : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> |
| 216 |
%47:3 = fir.box_dims %46, %c0 : (!fir.box<!fir.ptr<!fir.array<?xf32>>>, index) -> (index, index, index) |
| 217 |
%48 = fir.shift %47#0 : (index) -> !fir.shift<1> |
| 218 |
%49 = fir.array_coor %46(%48) %c1 : (!fir.box<!fir.ptr<!fir.array<?xf32>>>, !fir.shift<1>, index) -> !fir.ref<f32> |
| 219 |
// module data :: real, pointer :: globp(:) |
| 220 |
// ALL: fir.store{{.*}}{tbaa = [#[[TARGETTAG]]]} : !fir.ref<f32> |
| 221 |
fir.store %cst to %49 : !fir.ref<f32> |
| 222 |
%50 = fir.array_coor %6(%5) %c1 : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>, index) -> !fir.ref<f32> |
| 223 |
// real :: dummyf(10) |
| 224 |
// ALL: fir.store{{.*}}{tbaa = [#[[DUMMYFTAG]]]} : !fir.ref<f32> |
| 225 |
fir.store %cst to %50 : !fir.ref<f32> |
| 226 |
%51 = fir.array_coor %7(%5) %c1 : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>, index) -> !fir.ref<f32> |
| 227 |
// real, target :: dummyft(10) |
| 228 |
// ALL: fir.store{{.*}}{tbaa = [#[[TARGETTAG]]]} : !fir.ref<f32> |
| 229 |
fir.store %cst to %51 : !fir.ref<f32> |
| 230 |
%52 = fir.array_coor %2 %c1 : (!fir.box<!fir.array<?xf32>>, index) -> !fir.ref<f32> |
| 231 |
// real :: dummyas(:) |
| 232 |
// ALL: fir.store{{.*}}{tbaa = [#[[DUMMYASTAG]]]} : !fir.ref<f32> |
| 233 |
fir.store %cst to %52 : !fir.ref<f32> |
| 234 |
%53 = fir.array_coor %3 %c1 : (!fir.box<!fir.array<?xf32>>, index) -> !fir.ref<f32> |
| 235 |
// real, target :: dummyast(:) |
| 236 |
// ALL: fir.store{{.*}}{tbaa = [#[[TARGETTAG]]]} : !fir.ref<f32> |
| 237 |
fir.store %cst to %53 : !fir.ref<f32> |
| 238 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 239 |
%54 = fir.load %1 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 240 |
%55 = fir.box_addr %54 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 241 |
%56:3 = fir.box_dims %54, %c0 : (!fir.box<!fir.heap<!fir.array<?xf32>>>, index) -> (index, index, index) |
| 242 |
%57 = fir.shape_shift %56#0, %56#1 : (index, index) -> !fir.shapeshift<1> |
| 243 |
%58 = fir.array_coor %55(%57) %c1 : (!fir.heap<!fir.array<?xf32>>, !fir.shapeshift<1>, index) -> !fir.ref<f32> |
| 244 |
// real, allocatable :: dummya(:) |
| 245 |
// ALL: fir.store{{.*}}{tbaa = [#[[DUMMYATAG]]]} : !fir.ref<f32> |
| 246 |
fir.store %cst to %58 : !fir.ref<f32> |
| 247 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 248 |
%59 = fir.load %4 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 249 |
%60 = fir.box_addr %59 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 250 |
%61:3 = fir.box_dims %59, %c0 : (!fir.box<!fir.heap<!fir.array<?xf32>>>, index) -> (index, index, index) |
| 251 |
%62 = fir.shape_shift %61#0, %61#1 : (index, index) -> !fir.shapeshift<1> |
| 252 |
%63 = fir.array_coor %60(%62) %c1 : (!fir.heap<!fir.array<?xf32>>, !fir.shapeshift<1>, index) -> !fir.ref<f32> |
| 253 |
// real, allocatable, target :: dummyat(:) |
| 254 |
// ALL: fir.store{{.*}}{tbaa = [#[[TARGETTAG]]]} : !fir.ref<f32> |
| 255 |
fir.store %cst to %63 : !fir.ref<f32> |
| 256 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 257 |
%64 = fir.load %8 : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> |
| 258 |
%65:3 = fir.box_dims %64, %c0 : (!fir.box<!fir.ptr<!fir.array<?xf32>>>, index) -> (index, index, index) |
| 259 |
%66 = fir.shift %65#0 : (index) -> !fir.shift<1> |
| 260 |
%67 = fir.array_coor %64(%66) %c1 : (!fir.box<!fir.ptr<!fir.array<?xf32>>>, !fir.shift<1>, index) -> !fir.ref<f32> |
| 261 |
// real, pointer :: dummyp(:) |
| 262 |
// ALL: fir.store{{.*}}{tbaa = [#[[TARGETTAG]]]} : !fir.ref<f32> |
| 263 |
fir.store %cst to %67 : !fir.ref<f32> |
| 264 |
%68 = fir.array_coor %20(%5) %c1 : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>, index) -> !fir.ref<f32> |
| 265 |
// real :: local(10) |
| 266 |
// DEFAULT: fir.store{{.*}}tbaa |
| 267 |
// LOCAL: fir.store{{.*}}{tbaa = [#[[LOCALTAG]]]} : !fir.ref<f32> |
| 268 |
fir.store %cst to %68 : !fir.ref<f32> |
| 269 |
%69 = fir.array_coor %33(%5) %c1 : (!fir.ref<!fir.array<10xf32>>, !fir.shape<1>, index) -> !fir.ref<f32> |
| 270 |
// real, target :: localt(10) |
| 271 |
// DEFAULT: fir.store{{.*}}tbaa |
| 272 |
// LOCAL: fir.store{{.*}}{tbaa = [#[[LOCALTTAG]]]} : !fir.ref<f32> |
| 273 |
fir.store %cst to %69 : !fir.ref<f32> |
| 274 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 275 |
%70 = fir.load %25 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 276 |
%71 = fir.box_addr %70 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 277 |
%72:3 = fir.box_dims %70, %c0 : (!fir.box<!fir.heap<!fir.array<?xf32>>>, index) -> (index, index, index) |
| 278 |
%73 = fir.shape_shift %72#0, %72#1 : (index, index) -> !fir.shapeshift<1> |
| 279 |
%74 = fir.array_coor %71(%73) %c1 : (!fir.heap<!fir.array<?xf32>>, !fir.shapeshift<1>, index) -> !fir.ref<f32> |
| 280 |
// real, allocatable :: locala(:) |
| 281 |
// DEFAULT: fir.store{{.*}}tbaa |
| 282 |
// LOCAL: fir.store{{.*}}{tbaa = [#[[LOCALATAG]]]} : !fir.ref<f32> |
| 283 |
fir.store %cst to %74 : !fir.ref<f32> |
| 284 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 285 |
%75 = fir.load %27 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 286 |
%76 = fir.box_addr %75 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 287 |
%77:3 = fir.box_dims %75, %c0 : (!fir.box<!fir.heap<!fir.array<?xf32>>>, index) -> (index, index, index) |
| 288 |
%78 = fir.shape_shift %77#0, %77#1 : (index, index) -> !fir.shapeshift<1> |
| 289 |
%79 = fir.array_coor %76(%78) %c1 : (!fir.heap<!fir.array<?xf32>>, !fir.shapeshift<1>, index) -> !fir.ref<f32> |
| 290 |
// real, allocatable, target :: localat(:) |
| 291 |
// DEFAULT: fir.store{{.*}}tbaa |
| 292 |
// LOCAL: fir.store{{.*}}{tbaa = [#[[LOCALATTAG]]]} : !fir.ref<f32> |
| 293 |
fir.store %cst to %79 : !fir.ref<f32> |
| 294 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 295 |
%80 = fir.load %31 : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>> |
| 296 |
%81:3 = fir.box_dims %80, %c0 : (!fir.box<!fir.ptr<!fir.array<?xf32>>>, index) -> (index, index, index) |
| 297 |
%82 = fir.shift %81#0 : (index) -> !fir.shift<1> |
| 298 |
%83 = fir.array_coor %80(%82) %c1 : (!fir.box<!fir.ptr<!fir.array<?xf32>>>, !fir.shift<1>, index) -> !fir.ref<f32> |
| 299 |
// real, pointer :: localp(:) |
| 300 |
// DEFAULT: fir.store{{.*}}tbaa |
| 301 |
// LOCAL: fir.store{{.*}}{tbaa = [#[[TARGETTAG]]]} : !fir.ref<f32> |
| 302 |
fir.store %cst to %83 : !fir.ref<f32> |
| 303 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 304 |
%84 = fir.load %27 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 305 |
%85 = fir.box_addr %84 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 306 |
%86 = fir.convert %85 : (!fir.heap<!fir.array<?xf32>>) -> i64 |
| 307 |
%87 = arith.cmpi ne, %86, %c0_i64 : i64 |
| 308 |
fir.if %87 { |
| 309 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 310 |
%92 = fir.load %27 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 311 |
%93 = fir.box_addr %92 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 312 |
fir.freemem %93 : !fir.heap<!fir.array<?xf32>> |
| 313 |
// ALL-NOT: fir.store{{.*}}tbaa |
| 314 |
fir.store %24 to %27 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 315 |
} |
| 316 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 317 |
%88 = fir.load %25 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 318 |
%89 = fir.box_addr %88 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 319 |
%90 = fir.convert %89 : (!fir.heap<!fir.array<?xf32>>) -> i64 |
| 320 |
%91 = arith.cmpi ne, %90, %c0_i64 : i64 |
| 321 |
fir.if %91 { |
| 322 |
// ALL-NOT: fir.load{{.*}}tbaa |
| 323 |
%92 = fir.load %25 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 324 |
%93 = fir.box_addr %92 : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> |
| 325 |
fir.freemem %93 : !fir.heap<!fir.array<?xf32>> |
| 326 |
// ALL-NOT: fir.store{{.*}}tbaa |
| 327 |
fir.store %24 to %25 : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> |
| 328 |
} |
| 329 |
return |
| 330 |
} |
| 331 |
} |