| 1 |
// test without per-function tbaa trees so that this functionality does not bitrot |
| 2 |
// per-function tbaa tbaa-codegen2.fir |
| 3 |
// RUN: fir-opt %s --split-input-file --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu apply-tbaa=true" --per-function-tbaa-trees=false | FileCheck %s |
| 4 |
// RUN: fir-opt %s --split-input-file --fir-to-llvm-ir="target=aarch64-unknown-linux-gnu apply-tbaa=true" --per-function-tbaa-trees=false | FileCheck %s |
| 5 |
|
| 6 |
module { |
| 7 |
func.func @tbaa(%arg0: !fir.class<!fir.array<?xnone>> {fir.bindc_name = "a"}) { |
| 8 |
%c9_i8 = arith.constant 9 : i8 |
| 9 |
%c0_i64 = arith.constant 0 : i64 |
| 10 |
%c10_i32 = arith.constant 10 : i32 |
| 11 |
%0 = fir.coordinate_of %arg0, %c0_i64 : (!fir.class<!fir.array<?xnone>>, i64) -> !fir.ref<none> |
| 12 |
%1 = fir.embox %0 source_box %arg0 : (!fir.ref<none>, !fir.class<!fir.array<?xnone>>) -> !fir.class<none> |
| 13 |
%2 = fir.box_typecode %1 : (!fir.class<none>) -> i8 |
| 14 |
%3 = arith.cmpi eq, %2, %c9_i8 : i8 |
| 15 |
cf.cond_br %3, ^bb1, ^bb2 |
| 16 |
^bb1: // pred: ^bb0 |
| 17 |
%4 = fir.box_addr %1 : (!fir.class<none>) -> !fir.ref<i32> |
| 18 |
fir.store %c10_i32 to %4 : !fir.ref<i32> |
| 19 |
cf.br ^bb2 |
| 20 |
^bb2: // 2 preds: ^bb0, ^bb1 |
| 21 |
return |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 26 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 27 |
// CHECK-DAG: #[[ANYDACC:.*]] = #llvm.tbaa_type_desc<id = "any data access", members = {<#[[ANYACC]], 0>}> |
| 28 |
// CHECK-DAG: #[[BOXMEM:.*]] = #llvm.tbaa_type_desc<id = "descriptor member", members = {<#[[ANYACC]], 0>}> |
| 29 |
// CHECK-DAG: #[[$BOXT:.*]] = #llvm.tbaa_tag<base_type = #[[BOXMEM]], access_type = #[[BOXMEM]], offset = 0> |
| 30 |
// CHECK-DAG: #[[$DATAT:.*]] = #llvm.tbaa_tag<base_type = #[[ANYDACC]], access_type = #[[ANYDACC]], offset = 0> |
| 31 |
|
| 32 |
// CHECK-LABEL: llvm.func @tbaa( |
| 33 |
// CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr {fir.bindc_name = "a"}) { |
| 34 |
// CHECK: %[[VAL_1:.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 35 |
// CHECK: %[[VAL_2:.*]] = llvm.alloca %[[VAL_1]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr |
| 36 |
// CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(9 : i8) : i8 |
| 37 |
// CHECK: %[[VAL_4:.*]] = llvm.mlir.constant(0 : i64) : i64 |
| 38 |
// CHECK: %[[VAL_5:.*]] = llvm.mlir.constant(10 : i32) : i32 |
| 39 |
// CHECK: %[[VAL_6:.*]] = llvm.getelementptr %[[VAL_0]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 40 |
// CHECK: %[[VAL_7:.*]] = llvm.load %[[VAL_6]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> !llvm.ptr |
| 41 |
// CHECK: %[[VAL_8:.*]] = llvm.mlir.constant(0 : i64) : i64 |
| 42 |
// CHECK: %[[VAL_9:.*]] = llvm.getelementptr %[[VAL_0]][0, 7, 0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 43 |
// CHECK: %[[VAL_10:.*]] = llvm.load %[[VAL_9]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 44 |
// CHECK: %[[VAL_11:.*]] = llvm.mul %[[VAL_4]], %[[VAL_10]] overflow<nsw> : i64 |
| 45 |
// CHECK: %[[VAL_12:.*]] = llvm.add %[[VAL_11]], %[[VAL_8]] overflow<nsw> : i64 |
| 46 |
// CHECK: %[[VAL_14:.*]] = llvm.getelementptr %[[VAL_7]]{{\[}}%[[VAL_12]]] : (!llvm.ptr, i64) -> !llvm.ptr, i8 |
| 47 |
// CHECK: %[[VAL_16:.*]] = llvm.mlir.constant(0 : i64) : i64 |
| 48 |
// CHECK: %[[VAL_17:.*]] = llvm.mlir.constant(-1 : i32) : i32 |
| 49 |
// CHECK: %[[VAL_18:.*]] = llvm.getelementptr %[[VAL_0]][0, 8] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 50 |
// CHECK: %[[VAL_19:.*]] = llvm.load %[[VAL_18]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> !llvm.ptr |
| 51 |
// CHECK: %[[VAL_20:.*]] = llvm.getelementptr %[[VAL_0]][0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 52 |
// CHECK: %[[VAL_21:.*]] = llvm.load %[[VAL_20]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 53 |
// CHECK: %[[VAL_22:.*]] = llvm.getelementptr %[[VAL_0]][0, 4] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 54 |
// CHECK: %[[VAL_23:.*]] = llvm.load %[[VAL_22]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i8 |
| 55 |
// CHECK-NEXT: %[[VAL_23_EXT:.*]] = llvm.sext %[[VAL_23]] : i8 to i32 |
| 56 |
// CHECK: %[[EXTRA_GEP:.*]] = llvm.getelementptr %[[VAL_0]][0, 6] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 57 |
// CHECK: %[[EXTRA:.*]] = llvm.load %[[EXTRA_GEP]] {tbaa = [#tbaa_tag]} : !llvm.ptr -> i8 |
| 58 |
// CHECK: %[[VAL_24:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 59 |
// CHECK: %[[VAL_25:.*]] = llvm.insertvalue %[[VAL_21]], %[[VAL_24]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 60 |
// CHECK: %[[VAL_26:.*]] = llvm.mlir.constant(20240719 : i32) : i32 |
| 61 |
// CHECK: %[[VAL_27:.*]] = llvm.insertvalue %[[VAL_26]], %[[VAL_25]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 62 |
// CHECK: %[[VAL_28:.*]] = llvm.mlir.constant(0 : i32) : i32 |
| 63 |
// CHECK: %[[VAL_29:.*]] = llvm.trunc %[[VAL_28]] : i32 to i8 |
| 64 |
// CHECK: %[[VAL_30:.*]] = llvm.insertvalue %[[VAL_29]], %[[VAL_27]][3] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 65 |
// CHECK: %[[VAL_31:.*]] = llvm.trunc %[[VAL_23_EXT]] : i32 to i8 |
| 66 |
// CHECK: %[[VAL_32:.*]] = llvm.insertvalue %[[VAL_31]], %[[VAL_30]][4] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 67 |
// CHECK: %[[VAL_33:.*]] = llvm.mlir.constant(0 : i32) : i32 |
| 68 |
// CHECK: %[[VAL_34:.*]] = llvm.trunc %[[VAL_33]] : i32 to i8 |
| 69 |
// CHECK: %[[VAL_35:.*]] = llvm.insertvalue %[[VAL_34]], %[[VAL_32]][5] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 70 |
// CHECK: %[[VAL_36:.*]] = llvm.mlir.constant(1 : ui8) : i8 |
| 71 |
// CHECK: %[[VAL_37:.*]] = llvm.or %[[EXTRA]], %[[VAL_36]] : i8 |
| 72 |
// CHECK: %[[VAL_38:.*]] = llvm.insertvalue %[[VAL_37]], %[[VAL_35]][6] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 73 |
// CHECK: %[[VAL_40B:.*]] = llvm.insertvalue %[[VAL_19]], %[[VAL_38]][7] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 74 |
// CHECK: %[[VAL_40:.*]] = llvm.insertvalue %{{.*}}, %[[VAL_40B]][8, 0] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 75 |
// CHECK: %[[VAL_42:.*]] = llvm.insertvalue %[[VAL_14]], %[[VAL_40]][0] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 76 |
// CHECK: llvm.store %[[VAL_42]], %[[VAL_2]] {tbaa = [#[[$BOXT]]]} : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)>, !llvm.ptr |
| 77 |
// CHECK: %[[VAL_43:.*]] = llvm.getelementptr %[[VAL_2]][0, 4] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 78 |
// CHECK: %[[VAL_44:.*]] = llvm.load %[[VAL_43]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i8 |
| 79 |
// CHECK: %[[VAL_45:.*]] = llvm.icmp "eq" %[[VAL_44]], %[[VAL_3]] : i8 |
| 80 |
// CHECK: llvm.cond_br %[[VAL_45]], ^bb1, ^bb2 |
| 81 |
// CHECK: ^bb1: |
| 82 |
// CHECK: %[[VAL_46:.*]] = llvm.getelementptr %[[VAL_2]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)> |
| 83 |
// CHECK: %[[VAL_47:.*]] = llvm.load %[[VAL_46]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> !llvm.ptr |
| 84 |
// CHECK: llvm.store %[[VAL_5]], %[[VAL_47]] {tbaa = [#[[$DATAT]]]} : i32, !llvm.ptr |
| 85 |
// CHECK: llvm.br ^bb2 |
| 86 |
// CHECK: ^bb2: |
| 87 |
// CHECK: llvm.return |
| 88 |
// CHECK: } |
| 89 |
|
| 90 |
// ----- |
| 91 |
|
| 92 |
module { |
| 93 |
func.func @tbaa() { |
| 94 |
%c0 = arith.constant 0 : index |
| 95 |
%c8_i32 = arith.constant 8 : i32 |
| 96 |
%c-1_i32 = arith.constant -1 : i32 |
| 97 |
%0 = fir.address_of(@_QFEx) : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 98 |
%1 = fir.address_of(@_QQclX2E2F64756D6D792E66393000) : !fir.ref<!fir.char<1,12>> |
| 99 |
%2 = fir.convert %1 : (!fir.ref<!fir.char<1,12>>) -> !fir.ref<i8> |
| 100 |
%3 = fir.call @_FortranAioBeginExternalListOutput(%c-1_i32, %2, %c8_i32) fastmath<contract> : (i32, !fir.ref<i8>, i32) -> !fir.ref<i8> |
| 101 |
%4 = fir.load %0 : !fir.ref<!fir.class<!fir.ptr<!fir.array<?xnone>>>> |
| 102 |
%5:3 = fir.box_dims %4, %c0 : (!fir.class<!fir.ptr<!fir.array<?xnone>>>, index) -> (index, index, index) |
| 103 |
%6 = fircg.ext_rebox %4 origin %5#0 : (!fir.class<!fir.ptr<!fir.array<?xnone>>>, index) -> !fir.class<!fir.array<?xnone>> |
| 104 |
%7 = fir.convert %6 : (!fir.class<!fir.array<?xnone>>) -> !fir.box<none> |
| 105 |
%8 = fir.call @_FortranAioOutputDescriptor(%3, %7) fastmath<contract> : (!fir.ref<i8>, !fir.box<none>) -> i1 |
| 106 |
%9 = fir.call @_FortranAioEndIoStatement(%3) fastmath<contract> : (!fir.ref<i8>) -> i32 |
| 107 |
return |
| 108 |
} |
| 109 |
func.func private @_FortranAioBeginExternalListOutput(i32, !fir.ref<i8>, i32) -> !fir.ref<i8> attributes {fir.io, fir.runtime} |
| 110 |
func.func private @_FortranAioOutputDescriptor(!fir.ref<i8>, !fir.box<none>) -> i1 attributes {fir.io, fir.runtime} |
| 111 |
func.func private @_FortranAioEndIoStatement(!fir.ref<i8>) -> i32 attributes {fir.io, fir.runtime} |
| 112 |
fir.global linkonce @_QQclX2E2F64756D6D792E66393000 constant : !fir.char<1,12> { |
| 113 |
%0 = fir.string_lit "./dummy.f90\00"(12) : !fir.char<1,12> |
| 114 |
fir.has_value %0 : !fir.char<1,12> |
| 115 |
} |
| 116 |
fir.global internal @_QFEx : !fir.class<!fir.ptr<!fir.array<?xnone>>> { |
| 117 |
%c0 = arith.constant 0 : index |
| 118 |
%0 = fir.zero_bits !fir.ptr<!fir.array<?xnone>> |
| 119 |
%1 = fircg.ext_embox %0(%c0) : (!fir.ptr<!fir.array<?xnone>>, index) -> !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 120 |
fir.has_value %1 : !fir.class<!fir.ptr<!fir.array<?xnone>>> |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 125 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 126 |
// CHECK-DAG: #[[BOXMEM:.*]] = #llvm.tbaa_type_desc<id = "descriptor member", members = {<#[[ANYACC]], 0>}> |
| 127 |
// CHECK-DAG: #[[$BOXT:.*]] = #llvm.tbaa_tag<base_type = #[[BOXMEM]], access_type = #[[BOXMEM]], offset = 0> |
| 128 |
|
| 129 |
// CHECK-LABEL: llvm.func @tbaa() { |
| 130 |
// CHECK: %[[VAL_0:.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 131 |
// CHECK: %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr |
| 132 |
// CHECK: %[[VAL_2:.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 133 |
// CHECK: %[[VAL_3:.*]] = llvm.alloca %[[VAL_2]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr |
| 134 |
// CHECK: %[[VAL_4:.*]] = llvm.mlir.constant(0 : index) : i64 |
| 135 |
// CHECK: %[[VAL_5:.*]] = llvm.mlir.constant(8 : i32) : i32 |
| 136 |
// CHECK: %[[VAL_6:.*]] = llvm.mlir.constant(-1 : i32) : i32 |
| 137 |
// CHECK: %[[VAL_7:.*]] = llvm.mlir.addressof @_QFEx : !llvm.ptr |
| 138 |
// CHECK: %[[VAL_8:.*]] = llvm.mlir.addressof @_QQclX2E2F64756D6D792E66393000 : !llvm.ptr |
| 139 |
// CHECK: %[[VAL_10:.*]] = llvm.call @_FortranAioBeginExternalListOutput(%[[VAL_6]], %[[VAL_8]], %[[VAL_5]]) {fastmathFlags = #llvm.fastmath<contract>} : (i32, !llvm.ptr, i32) -> !llvm.ptr |
| 140 |
// CHECK: %[[VAL_11:.*]] = llvm.mlir.constant(64 : i32) : i32 |
| 141 |
// CHECK: "llvm.intr.memcpy"(%[[VAL_3]], %[[VAL_7]], %[[VAL_11]]) <{isVolatile = false, tbaa = [#[[$BOXT]]]}> |
| 142 |
// CHECK: %[[VAL_12:.*]] = llvm.getelementptr %[[VAL_3]][0, 7, %[[VAL_4]], 0] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 143 |
// CHECK: %[[VAL_13:.*]] = llvm.load %[[VAL_12]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 144 |
// CHECK: %[[VAL_14:.*]] = llvm.getelementptr %[[VAL_3]][0, 7, %[[VAL_4]], 1] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 145 |
// CHECK: %[[VAL_15:.*]] = llvm.load %[[VAL_14]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 146 |
// CHECK: %[[VAL_16:.*]] = llvm.getelementptr %[[VAL_3]][0, 7, %[[VAL_4]], 2] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 147 |
// CHECK: %[[VAL_17:.*]] = llvm.load %[[VAL_16]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 148 |
// CHECK: %[[VAL_18:.*]] = llvm.getelementptr %[[VAL_3]][0, 8] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 149 |
// CHECK: %[[VAL_19:.*]] = llvm.load %[[VAL_18]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> !llvm.ptr |
| 150 |
// CHECK: %[[VAL_20:.*]] = llvm.mlir.constant(0 : i64) : i64 |
| 151 |
// CHECK: %[[VAL_21:.*]] = llvm.mlir.constant(-1 : i32) : i32 |
| 152 |
// CHECK: %[[VAL_22:.*]] = llvm.getelementptr %[[VAL_3]][0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 153 |
// CHECK: %[[VAL_23:.*]] = llvm.load %[[VAL_22]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 154 |
// CHECK: %[[VAL_24:.*]] = llvm.getelementptr %[[VAL_3]][0, 4] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 155 |
// CHECK: %[[VAL_25:.*]] = llvm.load %[[VAL_24]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i8 |
| 156 |
// CHECK-NEXT: %[[VAL_25_EXT:.*]] = llvm.sext %[[VAL_25]] : i8 to i32 |
| 157 |
// CHECK: %[[VAL_26:.*]] = llvm.getelementptr %[[VAL_3]][0, 8] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 158 |
// CHECK: %[[VAL_27:.*]] = llvm.load %[[VAL_26]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> !llvm.ptr |
| 159 |
// CHECK: %[[VAL_28:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 160 |
// CHECK: %[[VAL_29:.*]] = llvm.insertvalue %[[VAL_23]], %[[VAL_28]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 161 |
// CHECK: %[[VAL_30:.*]] = llvm.mlir.constant(20240719 : i32) : i32 |
| 162 |
// CHECK: %[[VAL_31:.*]] = llvm.insertvalue %[[VAL_30]], %[[VAL_29]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 163 |
// CHECK: %[[VAL_32:.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 164 |
// CHECK: %[[VAL_33:.*]] = llvm.trunc %[[VAL_32]] : i32 to i8 |
| 165 |
// CHECK: %[[VAL_34:.*]] = llvm.insertvalue %[[VAL_33]], %[[VAL_31]][3] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 166 |
// CHECK: %[[VAL_35:.*]] = llvm.trunc %[[VAL_25_EXT]] : i32 to i8 |
| 167 |
// CHECK: %[[VAL_36:.*]] = llvm.insertvalue %[[VAL_35]], %[[VAL_34]][4] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 168 |
// CHECK: %[[VAL_37:.*]] = llvm.mlir.constant(0 : i32) : i32 |
| 169 |
// CHECK: %[[VAL_38:.*]] = llvm.trunc %[[VAL_37]] : i32 to i8 |
| 170 |
// CHECK: %[[VAL_39:.*]] = llvm.insertvalue %[[VAL_38]], %[[VAL_36]][5] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 171 |
// CHECK: %[[VAL_42:.*]] = llvm.insertvalue %{{.*}}, %[[VAL_39]][6] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 172 |
// CHECK: %[[VAL_44B:.*]] = llvm.insertvalue %[[VAL_27]], %[[VAL_42]][8] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 173 |
// CHECK: %[[VAL_44:.*]] = llvm.insertvalue %{{.*}}, %[[VAL_44B]][9, 0] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 174 |
// CHECK: %[[VAL_45:.*]] = llvm.getelementptr %[[VAL_3]][0, 7, 0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 175 |
// CHECK: %[[VAL_46:.*]] = llvm.load %[[VAL_45]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 176 |
// CHECK: %[[VAL_47:.*]] = llvm.getelementptr %[[VAL_3]][0, 7, 0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 177 |
// CHECK: %[[VAL_48:.*]] = llvm.load %[[VAL_47]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 178 |
// CHECK: %[[VAL_49:.*]] = llvm.getelementptr %[[VAL_3]][0, 7, 0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 179 |
// CHECK: %[[VAL_50:.*]] = llvm.load %[[VAL_49]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 180 |
// CHECK: %[[VAL_51:.*]] = llvm.getelementptr %[[VAL_3]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 181 |
// CHECK: %[[VAL_52:.*]] = llvm.load %[[VAL_51]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> !llvm.ptr |
| 182 |
// CHECK: %[[VAL_53:.*]] = llvm.mlir.constant(0 : i64) : i64 |
| 183 |
// CHECK: %[[VAL_54:.*]] = llvm.mlir.constant(1 : i64) : i64 |
| 184 |
// CHECK: %[[VAL_55:.*]] = llvm.icmp "eq" %[[VAL_48]], %[[VAL_53]] : i64 |
| 185 |
// CHECK: %[[VAL_56:.*]] = llvm.select %[[VAL_55]], %[[VAL_54]], %[[VAL_13]] : i1, i64 |
| 186 |
// CHECK: %[[VAL_57:.*]] = llvm.insertvalue %[[VAL_56]], %[[VAL_44]][7, 0, 0] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 187 |
// CHECK: %[[VAL_58:.*]] = llvm.insertvalue %[[VAL_48]], %[[VAL_57]][7, 0, 1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 188 |
// CHECK: %[[VAL_59:.*]] = llvm.insertvalue %[[VAL_50]], %[[VAL_58]][7, 0, 2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 189 |
// CHECK: %[[VAL_61:.*]] = llvm.insertvalue %[[VAL_52]], %[[VAL_59]][0] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 190 |
// CHECK: llvm.store %[[VAL_61]], %[[VAL_1]] {tbaa = [#[[$BOXT]]]} : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)>, !llvm.ptr |
| 191 |
// CHECK: %[[VAL_63:.*]] = llvm.call @_FortranAioOutputDescriptor(%[[VAL_10]], %[[VAL_1]]) {fastmathFlags = #llvm.fastmath<contract>} : (!llvm.ptr, !llvm.ptr) -> i1 |
| 192 |
// CHECK: %[[VAL_64:.*]] = llvm.call @_FortranAioEndIoStatement(%[[VAL_10]]) {fastmathFlags = #llvm.fastmath<contract>} : (!llvm.ptr) -> i32 |
| 193 |
// CHECK: llvm.return |
| 194 |
// CHECK: } |
| 195 |
// CHECK: llvm.func @_FortranAioBeginExternalListOutput(i32, !llvm.ptr, i32) -> !llvm.ptr attributes {fir.io, fir.runtime, sym_visibility = "private"} |
| 196 |
// CHECK: llvm.func @_FortranAioOutputDescriptor(!llvm.ptr, !llvm.ptr) -> i1 attributes {fir.io, fir.runtime, sym_visibility = "private"} |
| 197 |
// CHECK: llvm.func @_FortranAioEndIoStatement(!llvm.ptr) -> i32 attributes {fir.io, fir.runtime, sym_visibility = "private"} |
| 198 |
|
| 199 |
// CHECK-LABEL: llvm.mlir.global linkonce constant @_QQclX2E2F64756D6D792E66393000() comdat(@__llvm_comdat::@_QQclX2E2F64756D6D792E66393000) {addr_space = 0 : i32} : !llvm.array<12 x i8> { |
| 200 |
// CHECK: %[[VAL_0:.*]] = llvm.mlir.constant("./dummy.f90\00") : !llvm.array<12 x i8> |
| 201 |
// CHECK: llvm.return %[[VAL_0]] : !llvm.array<12 x i8> |
| 202 |
// CHECK: } |
| 203 |
|
| 204 |
// CHECK-LABEL: llvm.mlir.global internal @_QFEx() {addr_space = 0 : i32} : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> { |
| 205 |
// CHECK: %[[VAL_0:.*]] = llvm.mlir.constant(0 : index) : i64 |
| 206 |
// CHECK: %[[VAL_1:.*]] = llvm.mlir.zero : !llvm.ptr |
| 207 |
// CHECK: %[[VAL_2:.*]] = llvm.mlir.constant(0 : i64) : i64 |
| 208 |
// CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(-1 : i32) : i32 |
| 209 |
// CHECK: %[[VAL_4:.*]] = llvm.mlir.undef : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 210 |
// CHECK: %[[VAL_5:.*]] = llvm.insertvalue %[[VAL_2]], %[[VAL_4]][1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 211 |
// CHECK: %[[VAL_6:.*]] = llvm.mlir.constant(20240719 : i32) : i32 |
| 212 |
// CHECK: %[[VAL_7:.*]] = llvm.insertvalue %[[VAL_6]], %[[VAL_5]][2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 213 |
// CHECK: %[[VAL_8:.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 214 |
// CHECK: %[[VAL_9:.*]] = llvm.trunc %[[VAL_8]] : i32 to i8 |
| 215 |
// CHECK: %[[VAL_10:.*]] = llvm.insertvalue %[[VAL_9]], %[[VAL_7]][3] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 216 |
// CHECK: %[[VAL_11:.*]] = llvm.trunc %[[VAL_3]] : i32 to i8 |
| 217 |
// CHECK: %[[VAL_12:.*]] = llvm.insertvalue %[[VAL_11]], %[[VAL_10]][4] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 218 |
// CHECK: %[[VAL_13:.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 219 |
// CHECK: %[[VAL_14:.*]] = llvm.trunc %[[VAL_13]] : i32 to i8 |
| 220 |
// CHECK: %[[VAL_15:.*]] = llvm.insertvalue %[[VAL_14]], %[[VAL_12]][5] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 221 |
// CHECK: %[[VAL_16:.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 222 |
// CHECK: %[[VAL_17:.*]] = llvm.trunc %[[VAL_16]] : i32 to i8 |
| 223 |
// CHECK: %[[VAL_18:.*]] = llvm.insertvalue %[[VAL_17]], %[[VAL_15]][6] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 224 |
// CHECK: %[[VAL_19:.*]] = llvm.mlir.zero : !llvm.ptr |
| 225 |
// CHECK: %[[VAL_21B:.*]] = llvm.insertvalue %[[VAL_19]], %[[VAL_18]][8] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 226 |
// CHECK: %[[VAL_21:.*]] = llvm.insertvalue %{{.*}}, %[[VAL_21B]][9, 0] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 227 |
// CHECK: %[[VAL_22:.*]] = llvm.mlir.constant(0 : i64) : i64 |
| 228 |
// CHECK: %[[VAL_23:.*]] = llvm.mlir.constant(1 : i64) : i64 |
| 229 |
// CHECK: %[[VAL_24:.*]] = llvm.insertvalue %[[VAL_23]], %[[VAL_21]][7, 0, 0] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 230 |
// CHECK: %[[VAL_25:.*]] = llvm.insertvalue %[[VAL_0]], %[[VAL_24]][7, 0, 1] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 231 |
// CHECK: %[[VAL_26:.*]] = llvm.insertvalue %[[VAL_2]], %[[VAL_25]][7, 0, 2] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 232 |
// CHECK: %[[VAL_27:.*]] = llvm.mul %[[VAL_2]], %[[VAL_0]] : i64 |
| 233 |
// CHECK: %[[VAL_28:.*]] = llvm.mul %[[VAL_23]], %[[VAL_0]] : i64 |
| 234 |
// CHECK: %[[VAL_30:.*]] = llvm.insertvalue %[[VAL_1]], %[[VAL_26]][0] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 235 |
// CHECK: llvm.return %[[VAL_30]] : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> |
| 236 |
// CHECK: } |
| 237 |
|
| 238 |
// ----- |
| 239 |
|
| 240 |
func.func @tbaa(%arg0: !fir.box<!fir.array<*:f64>>) -> i32 { |
| 241 |
%0 = fir.box_rank %arg0 : (!fir.box<!fir.array<*:f64>>) -> i32 |
| 242 |
return %0 : i32 |
| 243 |
} |
| 244 |
|
| 245 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 246 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 247 |
// CHECK-DAG: #[[BOXMEM:.*]] = #llvm.tbaa_type_desc<id = "descriptor member", members = {<#[[ANYACC]], 0>}> |
| 248 |
// CHECK-DAG: #[[$BOXT:.*]] = #llvm.tbaa_tag<base_type = #[[BOXMEM]], access_type = #[[BOXMEM]], offset = 0> |
| 249 |
|
| 250 |
// CHECK-LABEL: llvm.func @tbaa( |
| 251 |
// CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr) -> i32 { |
| 252 |
// CHECK: %[[VAL_1:.*]] = llvm.getelementptr %[[VAL_0]][0, 3] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<15 x array<3 x i64>>)> |
| 253 |
// CHECK: %[[VAL_2:.*]] = llvm.load %[[VAL_1]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i8 |
| 254 |
// CHECK: %[[VAL_3:.*]] = llvm.sext %[[VAL_2]] : i8 to i32 |
| 255 |
// CHECK: llvm.return %[[VAL_3]] : i32 |
| 256 |
// CHECK: } |
| 257 |
|
| 258 |
// ----- |
| 259 |
|
| 260 |
func.func @tbaa(%arg0: !fir.box<!fir.array<*:f64>>) -> i1 { |
| 261 |
%0 = fir.box_isarray %arg0 : (!fir.box<!fir.array<*:f64>>) -> i1 |
| 262 |
return %0 : i1 |
| 263 |
} |
| 264 |
|
| 265 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 266 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 267 |
// CHECK-DAG: #[[BOXMEM:.*]] = #llvm.tbaa_type_desc<id = "descriptor member", members = {<#[[ANYACC]], 0>}> |
| 268 |
// CHECK-DAG: #[[$BOXT:.*]] = #llvm.tbaa_tag<base_type = #[[BOXMEM]], access_type = #[[BOXMEM]], offset = 0> |
| 269 |
|
| 270 |
// CHECK-LABEL: llvm.func @tbaa( |
| 271 |
// CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr) -> i1 { |
| 272 |
// CHECK: %[[VAL_1:.*]] = llvm.getelementptr %[[VAL_0]][0, 3] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<15 x array<3 x i64>>)> |
| 273 |
// CHECK: %[[VAL_2:.*]] = llvm.load %[[VAL_1]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i8 |
| 274 |
// CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(0 : i64) : i8 |
| 275 |
// CHECK: %[[VAL_4:.*]] = llvm.icmp "ne" %[[VAL_2]], %[[VAL_3]] : i8 |
| 276 |
// CHECK: llvm.return %[[VAL_4]] : i1 |
| 277 |
// CHECK: } |
| 278 |
|
| 279 |
// ----- |
| 280 |
|
| 281 |
func.func @tbaa(%arg0: !fir.box<f32>) -> i32 { |
| 282 |
%0 = fir.box_elesize %arg0 : (!fir.box<f32>) -> i32 |
| 283 |
return %0 : i32 |
| 284 |
} |
| 285 |
|
| 286 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 287 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 288 |
// CHECK-DAG: #[[BOXMEM:.*]] = #llvm.tbaa_type_desc<id = "descriptor member", members = {<#[[ANYACC]], 0>}> |
| 289 |
// CHECK-DAG: #[[$BOXT:.*]] = #llvm.tbaa_tag<base_type = #[[BOXMEM]], access_type = #[[BOXMEM]], offset = 0> |
| 290 |
|
| 291 |
// CHECK-LABEL: llvm.func @tbaa( |
| 292 |
// CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr) -> i32 { |
| 293 |
// CHECK: %[[VAL_1:.*]] = llvm.getelementptr %[[VAL_0]][0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)> |
| 294 |
// CHECK: %[[VAL_2:.*]] = llvm.load %[[VAL_1]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 295 |
// CHECK: %[[VAL_3:.*]] = llvm.trunc %[[VAL_2]] : i64 to i32 |
| 296 |
// CHECK: llvm.return %[[VAL_3]] : i32 |
| 297 |
// CHECK: } |
| 298 |
|
| 299 |
// ----- |
| 300 |
|
| 301 |
func.func @tbaa(%arg0: !fir.box<!fir.array<*:f64>>) -> i1 { |
| 302 |
%0 = fir.box_isalloc %arg0 : (!fir.box<!fir.array<*:f64>>) -> i1 |
| 303 |
return %0 : i1 |
| 304 |
} |
| 305 |
|
| 306 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 307 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 308 |
// CHECK-DAG: #[[BOXMEM:.*]] = #llvm.tbaa_type_desc<id = "descriptor member", members = {<#[[ANYACC]], 0>}> |
| 309 |
// CHECK-DAG: #[[$BOXT:.*]] = #llvm.tbaa_tag<base_type = #[[BOXMEM]], access_type = #[[BOXMEM]], offset = 0> |
| 310 |
|
| 311 |
// CHECK-LABEL: llvm.func @tbaa( |
| 312 |
// CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr) -> i1 { |
| 313 |
// CHECK: %[[VAL_1:.*]] = llvm.getelementptr %[[VAL_0]][0, 5] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<15 x array<3 x i64>>)> |
| 314 |
// CHECK: %[[VAL_2:.*]] = llvm.load %[[VAL_1]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i8 |
| 315 |
// CHECK: %[[VAL_2_I32:.*]] = llvm.sext %[[VAL_2]] : i8 to i32 |
| 316 |
// CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(2 : i32) : i32 |
| 317 |
// CHECK: %[[VAL_4:.*]] = llvm.and %[[VAL_2_I32]], %[[VAL_3]] : i32 |
| 318 |
// CHECK: %[[VAL_5:.*]] = llvm.mlir.constant(0 : i32) : i32 |
| 319 |
// CHECK: %[[VAL_6:.*]] = llvm.icmp "ne" %[[VAL_4]], %[[VAL_5]] : i32 |
| 320 |
// CHECK: llvm.return %[[VAL_6]] : i1 |
| 321 |
// CHECK: } |
| 322 |
|
| 323 |
// ----- |
| 324 |
|
| 325 |
func.func @tbaa(%arg0: !fir.box<!fir.array<?xi32>>) { |
| 326 |
%c0 = arith.constant 0 : i64 |
| 327 |
%1 = fircg.ext_array_coor %arg0(%c0) <%c0> : (!fir.box<!fir.array<?xi32>>, i64, i64) -> !fir.ref<i32> |
| 328 |
return |
| 329 |
} |
| 330 |
|
| 331 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 332 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 333 |
// CHECK-DAG: #[[BOXMEM:.*]] = #llvm.tbaa_type_desc<id = "descriptor member", members = {<#[[ANYACC]], 0>}> |
| 334 |
// CHECK-DAG: #[[$BOXT:.*]] = #llvm.tbaa_tag<base_type = #[[BOXMEM]], access_type = #[[BOXMEM]], offset = 0> |
| 335 |
|
| 336 |
// CHECK-LABEL: llvm.func @tbaa( |
| 337 |
// CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr) { |
| 338 |
// CHECK: %[[VAL_1:.*]] = llvm.mlir.constant(0 : i64) : i64 |
| 339 |
// CHECK: %[[VAL_2:.*]] = llvm.mlir.constant(1 : i64) : i64 |
| 340 |
// CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(0 : i64) : i64 |
| 341 |
// CHECK: %[[VAL_4:.*]] = llvm.sub %[[VAL_1]], %[[VAL_2]] overflow<nsw> : i64 |
| 342 |
// CHECK: %[[VAL_5:.*]] = llvm.mul %[[VAL_4]], %[[VAL_2]] overflow<nsw> : i64 |
| 343 |
// CHECK: %[[VAL_6:.*]] = llvm.getelementptr %[[VAL_0]][0, 7, 0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> |
| 344 |
// CHECK: %[[VAL_7:.*]] = llvm.load %[[VAL_6]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i64 |
| 345 |
// CHECK: %[[VAL_8:.*]] = llvm.mul %[[VAL_5]], %[[VAL_7]] overflow<nsw> : i64 |
| 346 |
// CHECK: %[[VAL_9:.*]] = llvm.add %[[VAL_8]], %[[VAL_3]] overflow<nsw> : i64 |
| 347 |
// CHECK: %[[VAL_10:.*]] = llvm.getelementptr %[[VAL_0]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> |
| 348 |
// CHECK: %[[VAL_11:.*]] = llvm.load %[[VAL_10]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> !llvm.ptr |
| 349 |
// CHECK: %[[VAL_13:.*]] = llvm.getelementptr %[[VAL_11]]{{\[}}%[[VAL_9]]] : (!llvm.ptr, i64) -> !llvm.ptr, i8 |
| 350 |
// CHECK: llvm.return |
| 351 |
// CHECK: } |
| 352 |
|
| 353 |
// ----- |
| 354 |
|
| 355 |
// Check that the scalar aggregate load/store with a descriptor member |
| 356 |
// is mapped to any-access. |
| 357 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 358 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 359 |
// CHECK-DAG: #[[$ANYT:.*]] = #llvm.tbaa_tag<base_type = #[[ANYACC]], access_type = #[[ANYACC]], offset = 0> |
| 360 |
|
| 361 |
func.func @tbaa(%arg0: !fir.ref<!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>, %arg1: !fir.ref<!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>) { |
| 362 |
%0 = fir.load %arg0 : !fir.ref<!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>> |
| 363 |
fir.store %0 to %arg1 : !fir.ref<!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>> |
| 364 |
return |
| 365 |
} |
| 366 |
// CHECK-LABEL: llvm.func @tbaa( |
| 367 |
// CHECK: llvm.load{{.*}}{tbaa = [#[[$ANYT]]]} |
| 368 |
// CHECK: llvm.store{{.*}}{tbaa = [#[[$ANYT]]]} |
| 369 |
|
| 370 |
// ----- |
| 371 |
|
| 372 |
// Check that the array aggregate load/store with a descriptor member |
| 373 |
// is mapped to any-access. |
| 374 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 375 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 376 |
// CHECK-DAG: #[[$ANYT:.*]] = #llvm.tbaa_tag<base_type = #[[ANYACC]], access_type = #[[ANYACC]], offset = 0> |
| 377 |
|
| 378 |
func.func @tbaa(%arg0: !fir.ref<!fir.array<2x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>>, %arg1: !fir.ref<!fir.array<2x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>>) { |
| 379 |
%0 = fir.load %arg0 : !fir.ref<!fir.array<2x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>> |
| 380 |
fir.store %0 to %arg1 : !fir.ref<!fir.array<2x!fir.type<_QMtypesTt{x:!fir.box<!fir.heap<f32>>}>>> |
| 381 |
return |
| 382 |
} |
| 383 |
// CHECK-LABEL: llvm.func @tbaa( |
| 384 |
// CHECK: llvm.load{{.*}}{tbaa = [#[[$ANYT]]]} |
| 385 |
// CHECK: llvm.store{{.*}}{tbaa = [#[[$ANYT]]]} |
| 386 |
|
| 387 |
// ----- |
| 388 |
|
| 389 |
func.func @test_assumed_rank_load(%arg0: !fir.ref<!fir.box<!fir.array<*:f64>>>) -> () { |
| 390 |
%0 = fir.load %arg0 : !fir.ref<!fir.box<!fir.array<*:f64>>> |
| 391 |
fir.call @some_assumed_rank_func(%0) : (!fir.box<!fir.array<*:f64>>) -> () |
| 392 |
return |
| 393 |
} |
| 394 |
func.func private @some_assumed_rank_func(!fir.box<!fir.array<*:f64>>) -> () |
| 395 |
|
| 396 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 397 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 398 |
// CHECK-DAG: #[[BOXMEM:.*]] = #llvm.tbaa_type_desc<id = "descriptor member", members = {<#[[ANYACC]], 0>}> |
| 399 |
// CHECK-DAG: #[[$BOXT:.*]] = #llvm.tbaa_tag<base_type = #[[BOXMEM]], access_type = #[[BOXMEM]], offset = 0> |
| 400 |
|
| 401 |
// CHECK-LABEL: llvm.func @test_assumed_rank_load( |
| 402 |
// CHECK-SAME: %[[VAL_0:.*]]: !llvm.ptr) { |
| 403 |
// CHECK: %[[VAL_1:.*]] = llvm.mlir.constant(1 : i32) : i32 |
| 404 |
// CHECK: %[[VAL_2:.*]] = llvm.alloca %[[VAL_1]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<15 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr |
| 405 |
// CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(24 : i32) : i32 |
| 406 |
// CHECK: %[[VAL_4:.*]] = llvm.getelementptr %[[VAL_0]][0, 3] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<15 x array<3 x i64>>)> |
| 407 |
// CHECK: %[[VAL_5:.*]] = llvm.load %[[VAL_4]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i8 |
| 408 |
// CHECK: %[[VAL_6:.*]] = llvm.sext %[[VAL_5]] : i8 to i32 |
| 409 |
// CHECK: %[[VAL_7:.*]] = llvm.mlir.constant(24 : i32) : i32 |
| 410 |
// CHECK: %[[VAL_8:.*]] = llvm.mul %[[VAL_7]], %[[VAL_6]] : i32 |
| 411 |
// CHECK: %[[VAL_9:.*]] = llvm.add %[[VAL_3]], %[[VAL_8]] : i32 |
| 412 |
// CHECK: "llvm.intr.memcpy"(%[[VAL_2]], %[[VAL_0]], %[[VAL_9]]) <{isVolatile = false, tbaa = [#[[$BOXT]]]}> : (!llvm.ptr, !llvm.ptr, i32) -> () |
| 413 |
// CHECK: llvm.call @some_assumed_rank_func(%[[VAL_2]]) : (!llvm.ptr) -> () |
| 414 |
|
| 415 |
// ----- |
| 416 |
|
| 417 |
func.func @store_assumed_rank_box(%box: !fir.box<!fir.array<*:f32>>, %ref: !fir.ref<!fir.box<!fir.array<*:f32>>>) { |
| 418 |
fir.store %box to %ref : !fir.ref<!fir.box<!fir.array<*:f32>>> |
| 419 |
return |
| 420 |
} |
| 421 |
|
| 422 |
// CHECK-DAG: #[[ROOT:.*]] = #llvm.tbaa_root<id = "Flang function root "> |
| 423 |
// CHECK-DAG: #[[ANYACC:.*]] = #llvm.tbaa_type_desc<id = "any access", members = {<#[[ROOT]], 0>}> |
| 424 |
// CHECK-DAG: #[[BOXMEM:.*]] = #llvm.tbaa_type_desc<id = "descriptor member", members = {<#[[ANYACC]], 0>}> |
| 425 |
// CHECK-DAG: #[[$BOXT:.*]] = #llvm.tbaa_tag<base_type = #[[BOXMEM]], access_type = #[[BOXMEM]], offset = 0> |
| 426 |
|
| 427 |
// CHECK-LABEL: llvm.func @store_assumed_rank_box( |
| 428 |
// CHECK-SAME: %[[VAL_0:[^:]*]]: !llvm.ptr, |
| 429 |
// CHECK-SAME: %[[VAL_1:.*]]: !llvm.ptr) { |
| 430 |
// CHECK: %[[VAL_3:.*]] = llvm.getelementptr %[[VAL_0]][0, 3] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<15 x array<3 x i64>>)> |
| 431 |
// CHECK: %[[VAL_4:.*]] = llvm.load %[[VAL_3]] {tbaa = [#[[$BOXT]]]} : !llvm.ptr -> i8 |
| 432 |
// CHECK: "llvm.intr.memcpy"(%[[VAL_1]], %[[VAL_0]], %{{.*}}) <{isVolatile = false, tbaa = [#[[$BOXT]]]}> : (!llvm.ptr, !llvm.ptr, i32) -> () |