Skip to content

Commit 6042c2e

Browse files
committed
[flang] use TBAAForest in TBAABuilder
This is important to ensure that tags end up in the same trees that were created in the FIR TBAA pass. If they are in different trees then everything in one tree will be assumed to MayAlias with everything in the other tree. This leads to poor performance. @vzakhari requested that the old (not-per-function) trees are maintained so I left the old test intact. PR: #68437
1 parent db1d40f commit 6042c2e

File tree

5 files changed

+182
-76
lines changed

5 files changed

+182
-76
lines changed

flang/include/flang/Optimizer/CodeGen/TBAABuilder.h

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#ifndef FORTRAN_OPTIMIZER_CODEGEN_TBAABUILDER_H
1414
#define FORTRAN_OPTIMIZER_CODEGEN_TBAABUILDER_H
1515

16+
#include "flang/Optimizer/Analysis/TBAAForest.h"
1617
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
17-
#include "mlir/IR/BuiltinAttributes.h"
1818

1919
namespace fir {
2020

@@ -25,9 +25,9 @@ namespace fir {
2525
//
2626
// TBAA type information is represented with LLVM::MetadataOp operation
2727
// with specific symbol name `TBAABuilder::tbaaMetaOpName`. The basic
28-
// TBAA tree used for Flang consists of the following nodes:
28+
// TBAA trees used for Flang consists of the following nodes:
2929
// llvm.metadata @__flang_tbaa {
30-
// llvm.tbaa_root @root_0 {id = "Flang Type TBAA Root"}
30+
// llvm.tbaa_root @root_0 {id = "Flang Type TBAA Function Root funcName"}
3131
// llvm.tbaa_type_desc @type_desc_1 {id = "any access",
3232
// members = {<@root_0, 0>}}
3333
// llvm.tbaa_type_desc @type_desc_2 {id = "any data access",
@@ -162,9 +162,14 @@ namespace fir {
162162
// Given the storage association, all non-box accesses are represented
163163
// with the conservative data access tag:
164164
// < `<any data access>`, `<any data access>`, 0 >
165+
166+
// additional tags are added in flang/Optimizer/Transforms/AddAliasTags.cpp
167+
// (before CodeGen)
165168
class TBAABuilder {
166169
public:
167-
TBAABuilder(mlir::MLIRContext *context, bool applyTBAA);
170+
/// if forceUnifiedTree is true, functions will not have different TBAA trees
171+
TBAABuilder(mlir::MLIRContext *context, bool applyTBAA,
172+
bool forceUnifiedTree = false);
168173
TBAABuilder(TBAABuilder const &) = delete;
169174
TBAABuilder &operator=(TBAABuilder const &) = delete;
170175

@@ -184,56 +189,36 @@ class TBAABuilder {
184189

185190
// Returns TBAATagAttr representing access tag:
186191
// < <descriptor member>, <descriptor member>, 0 >
187-
mlir::LLVM::TBAATagAttr getAnyBoxAccessTag();
192+
mlir::LLVM::TBAATagAttr getAnyBoxAccessTag(mlir::LLVM::LLVMFuncOp func);
188193
// Returns TBAATagAttr representing access tag:
189194
// < <any data access>, <any data access>, 0 >
190-
mlir::LLVM::TBAATagAttr getAnyDataAccessTag();
195+
mlir::LLVM::TBAATagAttr getAnyDataAccessTag(mlir::LLVM::LLVMFuncOp func);
191196
// Returns TBAATagAttr representing access tag:
192197
// < <any access>, <any access>, 0 >
193-
mlir::LLVM::TBAATagAttr getAnyAccessTag();
198+
mlir::LLVM::TBAATagAttr getAnyAccessTag(mlir::LLVM::LLVMFuncOp func);
194199

195200
// Returns TBAATagAttr representing access tag described by the base and
196201
// access FIR types and the LLVM::GepOp representing the access in terms of
197202
// the FIR types converted to LLVM types. The base type must be derivative of
198203
// fir::BaseBoxType.
199204
mlir::LLVM::TBAATagAttr getBoxAccessTag(mlir::Type baseFIRType,
200205
mlir::Type accessFIRType,
201-
mlir::LLVM::GEPOp gep);
206+
mlir::LLVM::GEPOp gep,
207+
mlir::LLVM::LLVMFuncOp func);
202208

203209
// Returns TBAATagAttr representing access tag described by the base and
204210
// access FIR types and the LLVM::GepOp representing the access in terms of
205211
// the FIR types converted to LLVM types. The FIR types must describe the
206212
// "data" access, i.e. not an access of any box/descriptor member.
207213
mlir::LLVM::TBAATagAttr getDataAccessTag(mlir::Type baseFIRType,
208214
mlir::Type accessFIRType,
209-
mlir::LLVM::GEPOp gep);
215+
mlir::LLVM::GEPOp gep,
216+
mlir::LLVM::LLVMFuncOp func);
210217

211218
// Set to true, if TBAA builder is active, otherwise, all public
212219
// methods are no-ops.
213220
bool enableTBAA;
214221

215-
// LLVM::TBAARootAttr identifying Flang's TBAA root.
216-
mlir::LLVM::TBAARootAttr flangTBAARoot;
217-
// Identity string for Flang's TBAA root.
218-
static constexpr llvm::StringRef flangTBAARootId = "Flang Type TBAA Root";
219-
220-
// LLVM::TBAATypeDescriptorAttr identifying "any access".
221-
mlir::LLVM::TBAATypeDescriptorAttr anyAccessTypeDesc;
222-
// Identity string for "any access" type descriptor.
223-
static constexpr llvm::StringRef anyAccessTypeDescId = "any access";
224-
225-
// LLVM::TBAATypeDescriptorAttr identifying "any data access" (i.e. non-box
226-
// memory access).
227-
mlir::LLVM::TBAATypeDescriptorAttr anyDataAccessTypeDesc;
228-
// Identity string for "any data access" type descriptor.
229-
static constexpr llvm::StringRef anyDataAccessTypeDescId = "any data access";
230-
231-
// LLVM::TBAATypeDescriptorAttr identifying "descriptor member" access, i.e.
232-
// any access within the bounds of a box/descriptor.
233-
mlir::LLVM::TBAATypeDescriptorAttr boxMemberTypeDesc;
234-
// Identity string for "descriptor member" type descriptor.
235-
static constexpr llvm::StringRef boxMemberTypeDescId = "descriptor member";
236-
237222
// Number of attached TBAA tags (used for debugging).
238223
unsigned tagAttachmentCounter = 0;
239224

@@ -247,6 +232,8 @@ class TBAABuilder {
247232
std::tuple<mlir::LLVM::TBAANodeAttr, mlir::LLVM::TBAANodeAttr, int64_t>,
248233
mlir::LLVM::TBAATagAttr>
249234
tagsMap;
235+
236+
TBAAForrest trees;
250237
};
251238

252239
} // namespace fir

flang/lib/Optimizer/CodeGen/TBAABuilder.cpp

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#include "llvm/ADT/TypeSwitch.h"
1616
#include "llvm/Support/CommandLine.h"
1717
#include "llvm/Support/Debug.h"
18+
#include <mlir/Dialect/LLVMIR/LLVMAttrs.h>
19+
#include <mlir/Dialect/LLVMIR/LLVMDialect.h>
20+
#include <mlir/Dialect/LLVMIR/LLVMTypes.h>
1821

1922
#define DEBUG_TYPE "flang-tbaa-builder"
2023

@@ -27,6 +30,13 @@ static llvm::cl::opt<bool> disableTBAA(
2730
"to override default Flang behavior"),
2831
llvm::cl::init(false));
2932

33+
// disabling this will play badly with the FIR TBAA pass, leading to worse
34+
// performance
35+
static llvm::cl::opt<bool> perFunctionTBAATrees(
36+
"per-function-tbaa-trees",
37+
llvm::cl::desc("Give each function an independent TBAA tree (default)"),
38+
llvm::cl::init(true), llvm::cl::Hidden);
39+
3040
// tagAttachmentLimit is a debugging option that allows limiting
3141
// the number of TBAA access tag attributes attached to operations.
3242
// It is set to kTagAttachmentUnlimited by default denoting "no limit".
@@ -38,27 +48,12 @@ static llvm::cl::opt<unsigned>
3848

3949
namespace fir {
4050

41-
TBAABuilder::TBAABuilder(MLIRContext *context, bool applyTBAA)
42-
: enableTBAA(applyTBAA && !disableTBAA) {
51+
TBAABuilder::TBAABuilder(MLIRContext *context, bool applyTBAA,
52+
bool forceUnifiedTree)
53+
: enableTBAA(applyTBAA && !disableTBAA),
54+
trees(/*separatePerFunction=*/perFunctionTBAATrees && !forceUnifiedTree) {
4355
if (!enableTBAA)
4456
return;
45-
46-
// Root node.
47-
flangTBAARoot =
48-
TBAARootAttr::get(context, StringAttr::get(context, flangTBAARootId));
49-
50-
// Any access node.
51-
anyAccessTypeDesc = TBAATypeDescriptorAttr::get(
52-
context, anyAccessTypeDescId, TBAAMemberAttr::get(flangTBAARoot, 0));
53-
54-
// Any data access node.
55-
anyDataAccessTypeDesc =
56-
TBAATypeDescriptorAttr::get(context, anyDataAccessTypeDescId,
57-
TBAAMemberAttr::get(anyAccessTypeDesc, 0));
58-
59-
// Box member access node.
60-
boxMemberTypeDesc = TBAATypeDescriptorAttr::get(
61-
context, boxMemberTypeDescId, TBAAMemberAttr::get(anyAccessTypeDesc, 0));
6257
}
6358

6459
TBAATagAttr TBAABuilder::getAccessTag(TBAATypeDescriptorAttr baseTypeDesc,
@@ -73,26 +68,31 @@ TBAATagAttr TBAABuilder::getAccessTag(TBAATypeDescriptorAttr baseTypeDesc,
7368
return tag;
7469
}
7570

76-
TBAATagAttr TBAABuilder::getAnyBoxAccessTag() {
71+
TBAATagAttr TBAABuilder::getAnyBoxAccessTag(mlir::LLVM::LLVMFuncOp func) {
72+
TBAATypeDescriptorAttr boxMemberTypeDesc = trees[func].boxMemberTypeDesc;
7773
return getAccessTag(boxMemberTypeDesc, boxMemberTypeDesc, /*offset=*/0);
7874
}
7975

8076
TBAATagAttr TBAABuilder::getBoxAccessTag(Type baseFIRType, Type accessFIRType,
81-
GEPOp gep) {
82-
return getAnyBoxAccessTag();
77+
GEPOp gep,
78+
mlir::LLVM::LLVMFuncOp func) {
79+
return getAnyBoxAccessTag(func);
8380
}
8481

85-
TBAATagAttr TBAABuilder::getAnyDataAccessTag() {
82+
TBAATagAttr TBAABuilder::getAnyDataAccessTag(mlir::LLVM::LLVMFuncOp func) {
83+
TBAATypeDescriptorAttr anyDataAccessTypeDesc = trees[func].anyDataTypeDesc;
8684
return getAccessTag(anyDataAccessTypeDesc, anyDataAccessTypeDesc,
8785
/*offset=*/0);
8886
}
8987

9088
TBAATagAttr TBAABuilder::getDataAccessTag(Type baseFIRType, Type accessFIRType,
91-
GEPOp gep) {
92-
return getAnyDataAccessTag();
89+
GEPOp gep,
90+
mlir::LLVM::LLVMFuncOp func) {
91+
return getAnyDataAccessTag(func);
9392
}
9493

95-
TBAATagAttr TBAABuilder::getAnyAccessTag() {
94+
TBAATagAttr TBAABuilder::getAnyAccessTag(mlir::LLVM::LLVMFuncOp func) {
95+
TBAATypeDescriptorAttr anyAccessTypeDesc = trees[func].anyAccessDesc;
9696
return getAccessTag(anyAccessTypeDesc, anyAccessTypeDesc, /*offset=*/0);
9797
}
9898

@@ -101,6 +101,9 @@ void TBAABuilder::attachTBAATag(AliasAnalysisOpInterface op, Type baseFIRType,
101101
if (!enableTBAA)
102102
return;
103103

104+
mlir::LLVM::LLVMFuncOp func = op->getParentOfType<mlir::LLVM::LLVMFuncOp>();
105+
assert(func && "func.func should have already been converted to llvm.func");
106+
104107
++tagAttachmentCounter;
105108
if (tagAttachmentLimit != kTagAttachmentUnlimited &&
106109
tagAttachmentCounter > tagAttachmentLimit)
@@ -115,11 +118,11 @@ void TBAABuilder::attachTBAATag(AliasAnalysisOpInterface op, Type baseFIRType,
115118
// a mix of data members and descriptor members may alias
116119
// with both data and descriptor accesses.
117120
// Conservatively set any-access tag if there is any descriptor member.
118-
tbaaTagSym = getAnyAccessTag();
121+
tbaaTagSym = getAnyAccessTag(func);
119122
} else if (baseFIRType.isa<fir::BaseBoxType>()) {
120-
tbaaTagSym = getBoxAccessTag(baseFIRType, accessFIRType, gep);
123+
tbaaTagSym = getBoxAccessTag(baseFIRType, accessFIRType, gep, func);
121124
} else {
122-
tbaaTagSym = getDataAccessTag(baseFIRType, accessFIRType, gep);
125+
tbaaTagSym = getDataAccessTag(baseFIRType, accessFIRType, gep, func);
123126
}
124127

125128
if (!tbaaTagSym)

flang/test/Fir/tbaa-codegen.fir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#tbaa_type_desc = #llvm.tbaa_type_desc<id = "any access", members = {<#tbaa_root, 0>}>
1212
#tbaa_type_desc1 = #llvm.tbaa_type_desc<id = "any data access", members = {<#tbaa_type_desc, 0>}>
1313
#tbaa_type_desc2 = #llvm.tbaa_type_desc<id = "dummy arg data", members = {<#tbaa_type_desc1, 0>}>
14-
#tbaa_type_desc3 = #llvm.tbaa_type_desc<id = "dummy arg data/a", members = {<#tbaa_type_desc2, 0>}>
14+
#tbaa_type_desc3 = #llvm.tbaa_type_desc<id = "dummy arg data/_QFfuncEa", members = {<#tbaa_type_desc2, 0>}>
1515
#tbaa_tag = #llvm.tbaa_tag<base_type = #tbaa_type_desc3, access_type = #tbaa_type_desc3, offset = 0>
1616
module attributes {fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.target_triple = "aarch64-unknown-linux-gnu"} {
1717
func.func @_QPsimple(%arg0: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "a"}) {
@@ -39,9 +39,9 @@ module attributes {fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.targ
3939
// CHECK: store i32 %[[A2]], ptr %[[A1]], align 4, !tbaa ![[A_ACCESS_TAG]]
4040
// CHECK: ret void
4141
// CHECK: }
42+
// CHECK: ![[ANY_ACCESS_TYPE:.*]] = !{!"any access", ![[ROOT:.*]], i64 0}
43+
// CHECK: ![[ROOT]] = !{!"Flang function root _QPsimple"}
4244
// CHECK: ![[A_ACCESS_TAG]] = !{![[A_ACCESS_TYPE:.*]], ![[A_ACCESS_TYPE]], i64 0}
43-
// CHECK: ![[A_ACCESS_TYPE]] = !{!"dummy arg data/a", ![[DUMMY_ARG_TYPE:.*]], i64 0}
45+
// CHECK: ![[A_ACCESS_TYPE]] = !{!"dummy arg data/_QFfuncEa", ![[DUMMY_ARG_TYPE:.*]], i64 0}
4446
// CHECK: ![[DUMMY_ARG_TYPE]] = !{!"dummy arg data", ![[DATA_ACCESS_TYPE:.*]], i64 0}
45-
// CHECK: ![[DATA_ACCESS_TYPE]] = !{!"any data access", ![[ANY_ACCESS_TYPE:.*]], i64 0}
46-
// CHECK: ![[ANY_ACCESS_TYPE]] = !{!"any access", ![[ROOT:.*]], i64 0}
47-
// CHECK: ![[ROOT]] = !{!"Flang function root _QPsimple"}
47+
// CHECK: ![[DATA_ACCESS_TYPE]] = !{!"any data access", ![[ANY_ACCESS_TYPE]], i64 0}

flang/test/Fir/tbaa-codegen2.fir

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
// test that tbaa attributes can be added to fir.load and fir.store
2+
// and that these attributes are propagated to LLVMIR and that these
3+
// interoperrate with tbaa tags added during codegen
4+
5+
// RUN: tco %s | FileCheck %s
6+
7+
// subroutine func(a)
8+
// integer, intent(inout) :: a(:)
9+
// a = a+1
10+
// a(1) = a(2)
11+
#tbaa_root = #llvm.tbaa_root<id = "Flang function root _QPfunc">
12+
#tbaa_type_desc = #llvm.tbaa_type_desc<id = "any access", members = {<#tbaa_root, 0>}>
13+
#tbaa_type_desc1 = #llvm.tbaa_type_desc<id = "any data access", members = {<#tbaa_type_desc, 0>}>
14+
#tbaa_type_desc2 = #llvm.tbaa_type_desc<id = "dummy arg data", members = {<#tbaa_type_desc1, 0>}>
15+
#tbaa_type_desc3 = #llvm.tbaa_type_desc<id = "dummy arg data/_QFfuncEa", members = {<#tbaa_type_desc2, 0>}>
16+
#tbaa_tag = #llvm.tbaa_tag<base_type = #tbaa_type_desc3, access_type = #tbaa_type_desc3, offset = 0>
17+
module attributes {fir.defaultkind = "a1c4d8i4l4r4", fir.kindmap = "", llvm.target_triple = "aarch64-unknown-linux-gnu"} {
18+
func.func @_QPfunc(%arg0: !fir.box<!fir.array<?xi32>> {fir.bindc_name = "a"}) {
19+
%c3_i32 = arith.constant 3 : i32
20+
%c1_i32 = arith.constant 1 : i32
21+
%c0 = arith.constant 0 : index
22+
%c2 = arith.constant 2 : index
23+
%c1 = arith.constant 1 : index
24+
%0 = fir.alloca !fir.box<!fir.array<?xi32>>
25+
%1 = fir.declare %arg0 {fortran_attrs = #fir.var_attrs<intent_inout>, uniq_name = "_QFfuncEa"} : (!fir.box<!fir.array<?xi32>>) -> !fir.box<!fir.array<?xi32>>
26+
%2 = fir.rebox %1 : (!fir.box<!fir.array<?xi32>>) -> !fir.box<!fir.array<?xi32>>
27+
%3:3 = fir.box_dims %2, %c0 : (!fir.box<!fir.array<?xi32>>, index) -> (index, index, index)
28+
%4 = fir.shape %3#1 : (index) -> !fir.shape<1>
29+
%5 = fir.allocmem !fir.array<?xi32>, %3#1 {bindc_name = ".tmp.array", uniq_name = ""}
30+
%6 = fir.declare %5(%4) {uniq_name = ".tmp.array"} : (!fir.heap<!fir.array<?xi32>>, !fir.shape<1>) -> !fir.heap<!fir.array<?xi32>>
31+
%7 = fir.embox %6(%4) : (!fir.heap<!fir.array<?xi32>>, !fir.shape<1>) -> !fir.box<!fir.array<?xi32>>
32+
fir.do_loop %arg1 = %c1 to %3#1 step %c1 unordered {
33+
%16 = fir.array_coor %2 %arg1 : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
34+
// load with tbaa
35+
%17 = fir.load %16 {tbaa = [#tbaa_tag]} : !fir.ref<i32>
36+
%18 = arith.addi %17, %c1_i32 : i32
37+
%19 = fir.array_coor %6(%4) %arg1 : (!fir.heap<!fir.array<?xi32>>, !fir.shape<1>, index) -> !fir.ref<i32>
38+
// store without tbaa
39+
fir.store %18 to %19 : !fir.ref<i32>
40+
}
41+
fir.store %2 to %0 : !fir.ref<!fir.box<!fir.array<?xi32>>>
42+
%8 = fir.address_of(@_QQcl.2F746D702F73696D706C652E66393000) : !fir.ref<!fir.char<1,16>>
43+
%9 = fir.convert %0 : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> !fir.ref<!fir.box<none>>
44+
%10 = fir.convert %7 : (!fir.box<!fir.array<?xi32>>) -> !fir.box<none>
45+
%11 = fir.convert %8 : (!fir.ref<!fir.char<1,16>>) -> !fir.ref<i8>
46+
%12 = fir.call @_FortranAAssign(%9, %10, %11, %c3_i32) : (!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<i8>, i32) -> none
47+
fir.freemem %6 : !fir.heap<!fir.array<?xi32>>
48+
%13 = fir.array_coor %2 %c2 : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
49+
// load modified not to have tbaa
50+
%14 = fir.load %13 : !fir.ref<i32>
51+
%15 = fir.array_coor %2 %c1 : (!fir.box<!fir.array<?xi32>>, index) -> !fir.ref<i32>
52+
// store with tbaa
53+
fir.store %14 to %15 {tbaa = [#tbaa_tag]} : !fir.ref<i32>
54+
return
55+
}
56+
func.func private @_FortranAAssign(!fir.ref<!fir.box<none>>, !fir.box<none>, !fir.ref<i8>, i32) -> none attributes {fir.runtime}
57+
fir.global linkonce @_QQcl.2F746D702F73696D706C652E66393000 constant : !fir.char<1,16> {
58+
%0 = fir.string_lit "/tmp/simple.f90\00"(16) : !fir.char<1,16>
59+
fir.has_value %0 : !fir.char<1,16>
60+
}
61+
}
62+
// CHECK-LABEL: define void @_QPfunc(
63+
// CHECK-SAME: ptr %[[ARG0:.*]]) {
64+
// [...]
65+
// CHECK: %[[VAL5:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %[[ARG0]], i32 0, i32 7, i32 0, i32 0
66+
// box access:
67+
// CHECK: %[[VAL6:.*]] = load i64, ptr %[[VAL5]], align 4, !tbaa ![[BOX_ACCESS_TAG:.*]]
68+
// CHECK: %[[VAL7:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %0, i32 0, i32 7, i32 0, i32 1
69+
// box access:
70+
// CHECK: %[[VAL8:.*]] = load i64, ptr %[[VAL7]], align 4, !tbaa ![[BOX_ACCESS_TAG]]
71+
// CHECK: %[[VAL9:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %[[ARG0]], i32 0, i32 7, i32 0, i32 2
72+
// box access:
73+
// CHECK: %[[VAL10:.*]] = load i64, ptr %[[VAL9]], align 4, !tbaa ![[BOX_ACCESS_TAG]]
74+
// CHECK: %[[VAL11:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %[[ARG0]], i32 0, i32 0
75+
// box access:
76+
// CHECK: %[[VAL12:.*]] = load ptr, ptr %[[VAL11]], align 8, !tbaa ![[BOX_ACCESS_TAG]]
77+
// CHECK: %[[VAL15:.*]] = insertvalue { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %14, ptr %[[VAL12]], 0
78+
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %[[VAL15]], ptr %{{.*}}, align 8, !tbaa ![[BOX_ACCESS_TAG]]
79+
// CHECK: %[[VAL16:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %{{.*}}, i32 0, i32 7, i64 0, i32 0
80+
// box access:
81+
// CHECK: %[[VAL17:.*]] = load i64, ptr %[[VAL16]], align 4, !tbaa ![[BOX_ACCESS_TAG]]
82+
// CHECK: %[[VAL18:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %{{.*}}, i32 0, i32 7, i64 0, i32 1
83+
// box access:
84+
// CHECK: %[[VAL19:.*]] = load i64, ptr %[[VAL18]], align 4, !tbaa ![[BOX_ACCESS_TAG]]
85+
// CHECK: %[[VAL20:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %{{.*}}, i32 0, i32 7, i64 0, i32 2
86+
// box access:
87+
// CHECK: %[[VAL21:.*]] = load i64, ptr %[[VAL20]], align 4, !tbaa ![[BOX_ACCESS_TAG]]
88+
// [...]
89+
// box access:
90+
// CHECK: store { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] } %{{.*}}, ptr %{{.*}}, align 8, !tbaa ![[BOX_ACCESS_TAG]]
91+
// [...]
92+
93+
// [...]
94+
// CHECK: %[[VAL40:.*]] = getelementptr { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %{{.*}}, i32 0, i32 0
95+
// box access:
96+
// CHECK: %[[VAL41:.*]] = load ptr, ptr %[[VAL40]], align 8, !tbaa ![[BOX_ACCESS_TAG]]
97+
// CHECK: %[[VAL42:.*]] = getelementptr i8, ptr %[[VAL41]], i64 %{{.*}}
98+
// access to 'a':
99+
// CHECK: %[[VAL43:.*]] = load i32, ptr %[[VAL42]], align 4, !tbaa ![[A_ACCESS_TAG:.*]]
100+
// [...]
101+
// CHECK: %[[VAL50:.*]] = getelementptr i32, ptr %{{.*}}, i64 %{{.*}}
102+
// store to the temporary:
103+
// CHECK: store i32 %{{.*}}, ptr %[[VAL50]], align 4, !tbaa ![[DATA_ACCESS_TAG:.*]]
104+
// [...]
105+
106+
// CHECK: [[BOX_ACCESS_TAG]] = !{![[BOX_ACCESS_TYPE:.*]], ![[BOX_ACCESS_TYPE]], i64 0}
107+
// CHECK: ![[BOX_ACCESS_TYPE]] = !{!"descriptor member", ![[ANY_ACCESS_TYPE:.*]], i64 0}
108+
// CHECK: ![[ANY_ACCESS_TYPE]] = !{!"any access", ![[ROOT_TYPE:.*]], i64 0}
109+
// CHECK: ![[ROOT_TYPE]] = !{!"Flang function root _QPfunc"}
110+
// CHECK: ![[A_ACCESS_TAG]] = !{![[A_ACCESS_TYPE:.*]], ![[A_ACCESS_TYPE]], i64 0}
111+
// CHECK: ![[A_ACCESS_TYPE]] = !{!"dummy arg data/_QFfuncEa", ![[ARG_ACCESS_TYPE:.*]], i64 0}
112+
// CHECK: ![[ARG_ACCESS_TYPE]] = !{!"dummy arg data", ![[DATA_ACCESS_TYPE:.*]], i64 0}
113+
// CHECK: ![[DATA_ACCESS_TYPE]] = !{!"any data access", ![[ANY_ACCESS_TYPE]], i64 0}
114+
// CHECK: ![[DATA_ACCESS_TAG]] = !{![[DATA_ACCESS_TYPE]], ![[DATA_ACCESS_TYPE]], i64 0}

0 commit comments

Comments
 (0)