// RUN: fir-opt --split-input-file --pass-pipeline="builtin.module(fir-to-llvm-ir{apply-tbaa=true})" %s | FileCheck %s // Ensure that records with array members are identified as having descriptor members, // as reflected by the TBAA metadata. func.func @record_array_member(%arg0 : !fir.ref>>}>>}>>) { %c0_i64 = arith.constant 0 : i64 %c1 = arith.constant 1 : index %1 = fir.alloca !fir.type<_QFTt2{y:!fir.array<1x!fir.type<_QFTt{x:!fir.box>>}>>}> {bindc_name = "z", uniq_name = "_QFB1Ez"} fir.copy %arg0 to %1 no_overlap : !fir.ref>>}>>}>>, !fir.ref>>}>>}>> %3 = fir.coordinate_of %1, y : (!fir.ref>>}>>}>>) -> !fir.ref>>}>>> %4 = fircg.ext_array_coor %3(%c1)<%c1> : (!fir.ref>>}>>>, index, index) -> !fir.ref>>}>> %5 = fir.coordinate_of %4, x : (!fir.ref>>}>>) -> !fir.ref>>> %6 = fir.load %5 : !fir.ref>>> return } // CHECK: #[[$ATTR_0:.+]] = #llvm.tbaa_root // CHECK: #[[$ATTR_1:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[$ATTR_2:.+]] = #llvm.tbaa_tag // CHECK: #[[$ATTR_3:.+]] = #llvm.tbaa_type_desc}> // CHECK: #[[$ATTR_4:.+]] = #llvm.tbaa_tag // CHECK-LABEL: llvm.func @record_array_member( // CHECK-SAME: %[[ARG0:[0-9]+|[a-zA-Z$._-][a-zA-Z0-9$._-]*]]: !llvm.ptr) { // CHECK: %[[X_VAL:.*]] = llvm.alloca %{{.+}} x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr // CHECK: %[[Z_VAL:.*]] = llvm.alloca %{{.+}} x !llvm.struct<"_QFTt2", (array<1 x struct<"_QFTt", (struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>)>>)> {bindc_name = "z"} : (i64) -> !llvm.ptr // CHECK: "llvm.intr.memcpy"(%[[Z_VAL]], %[[ARG0]], %{{.+}}) <{{.*}}tbaa = [#[[$ATTR_2]]]{{.*}}> : (!llvm.ptr, !llvm.ptr, i64) -> () // CHECK: "llvm.intr.memcpy"(%[[X_VAL]], %{{.+}}, %{{.+}}) <{{.*}}tbaa = [#[[$ATTR_4]]]{{.*}}> : (!llvm.ptr, !llvm.ptr, i32) -> ()