// RUN: fir-opt --split-input-file --fir-add-alias-tags %s | FileCheck %s // Fortran source: // module data1 // real :: glob1, glob2 // equivalence (glob1, glob2) // end module data1 // subroutine test1 // use data1 // glob1 = glob2 // end subroutine test1 module attributes {dlti.dl_spec = #dlti.dl_spec : vector<4xi64>, i1 = dense<8> : vector<2xi64>, i8 = dense<8> : vector<2xi64>, i16 = dense<16> : vector<2xi64>, i32 = dense<32> : vector<2xi64>, i64 = dense<[32, 64]> : vector<2xi64>, f16 = dense<16> : vector<2xi64>, f64 = dense<64> : vector<2xi64>, f128 = dense<128> : vector<2xi64>, "dlti.endianness" = "little">, llvm.data_layout = ""} { fir.global @_QMdata1Eglob1 : !fir.array<4xi8> { %0 = fir.zero_bits !fir.array<4xi8> fir.has_value %0 : !fir.array<4xi8> } func.func @_QPtest1() { %c0 = arith.constant 0 : index %0 = fir.dummy_scope : !fir.dscope %1 = fir.address_of(@_QMdata1Eglob1) : !fir.ref> %2 = fir.coordinate_of %1, %c0 : (!fir.ref>, index) -> !fir.ref %3 = fir.convert %2 : (!fir.ref) -> !fir.ptr %4 = fir.declare %3 storage(%1[0]) {uniq_name = "_QMdata1Eglob1"} : (!fir.ptr, !fir.ref>) -> !fir.ptr %5 = fir.declare %3 storage(%1[0]) {uniq_name = "_QMdata1Eglob2"} : (!fir.ptr, !fir.ref>) -> !fir.ptr %6 = fir.load %5 : !fir.ptr fir.store %6 to %4 : !fir.ptr return } } // CHECK: #[[ROOT1:.+]] = #llvm.tbaa_root // CHECK: #[[ANYACC1:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[ANYDATA1:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[GLOBALDATA1:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[GLOB1COMMON:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[GLOB1:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[TAG:.+]] = #llvm.tbaa_tag // CHECK: %[[VAL_7:.*]] = fir.load{{.*}}{tbaa = [#[[TAG]]]} : !fir.ptr // CHECK: fir.store{{.*}}{tbaa = [#[[TAG]]]} : !fir.ptr // ----- // Fortran source: // module data2 // real :: glob1, glob2, glob3 // equivalence (glob1, glob2) // common /glob1/ glob1, glob3 // end module data2 // subroutine test2 // use data2 // glob1 = glob2 + glob3 // end subroutine test2 module attributes {dlti.dl_spec = #dlti.dl_spec : vector<4xi64>, i1 = dense<8> : vector<2xi64>, i8 = dense<8> : vector<2xi64>, i16 = dense<16> : vector<2xi64>, i32 = dense<32> : vector<2xi64>, i64 = dense<[32, 64]> : vector<2xi64>, f16 = dense<16> : vector<2xi64>, f64 = dense<64> : vector<2xi64>, f128 = dense<128> : vector<2xi64>, "dlti.endianness" = "little">, llvm.data_layout = ""} { fir.global common @glob1_(dense<0> : vector<8xi8>) {alignment = 4 : i64} : !fir.array<8xi8> func.func @_QPtest2() { %c4 = arith.constant 4 : index %c0 = arith.constant 0 : index %0 = fir.dummy_scope : !fir.dscope %1 = fir.address_of(@glob1_) : !fir.ref> %2 = fir.coordinate_of %1, %c0 : (!fir.ref>, index) -> !fir.ref %3 = fir.convert %2 : (!fir.ref) -> !fir.ptr %4 = fir.declare %3 storage(%1[0]) {uniq_name = "_QMdata2Eglob1"} : (!fir.ptr, !fir.ref>) -> !fir.ptr %5 = fir.declare %3 storage(%1[0]) {uniq_name = "_QMdata2Eglob2"} : (!fir.ptr, !fir.ref>) -> !fir.ptr %6 = fir.coordinate_of %1, %c4 : (!fir.ref>, index) -> !fir.ref %7 = fir.convert %6 : (!fir.ref) -> !fir.ref %8 = fir.declare %7 storage(%1[4]) {uniq_name = "_QMdata2Eglob3"} : (!fir.ref, !fir.ref>) -> !fir.ref %9 = fir.load %5 : !fir.ptr %10 = fir.load %8 : !fir.ref %11 = arith.addf %9, %10 fastmath : f32 fir.store %11 to %4 : !fir.ptr return } } // CHECK: #[[ROOT2:.+]] = #llvm.tbaa_root // CHECK: #[[ANYACC2:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[ANYDATA2:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[GLOBALDATA2:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[GLOB1COMMON:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[GLOB1GLOB2:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[GLOB3:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[GLOB1GLOB2TAG:.+]] = #llvm.tbaa_tag // CHECK: #[[GLOB3TAG:.+]] = #llvm.tbaa_tag // CHECK: fir.load{{.*}}{tbaa = [#[[GLOB1GLOB2TAG]]]} : !fir.ptr // CHECK: fir.load{{.*}}{tbaa = [#[[GLOB3TAG]]]} : !fir.ref // CHECK: fir.store{{.*}}{tbaa = [#[[GLOB1GLOB2TAG]]]} : !fir.ptr