Skip to content

Commit 10059b9

Browse files
PikachuHyAlanza
authored andcommitted
[CIR][Lowering][TBAA] Lower CIR_TBAAStructAttr (#1381)
1 parent e0244f3 commit 10059b9

File tree

2 files changed

+192
-25
lines changed

2 files changed

+192
-25
lines changed

clang/lib/CIR/Lowering/DirectToLLVM/LowerTBAAToLLVM.cpp

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,35 @@ class CIRToLLVMTBAAAttrLowering {
1616
public:
1717
CIRToLLVMTBAAAttrLowering(mlir::MLIRContext *mlirContext)
1818
: mlirContext(mlirContext) {}
19+
20+
mlir::LLVM::TBAATypeDescriptorAttr
21+
lowerCIRTBAAAttrToLLVMTBAAAttr(mlir::Attribute tbaa) {
22+
if (auto charAttr = mlir::dyn_cast<cir::TBAAOmnipotentCharAttr>(tbaa)) {
23+
return getChar();
24+
}
25+
if (auto scalarAttr = mlir::dyn_cast<cir::TBAAScalarAttr>(tbaa)) {
26+
mlir::DataLayout layout;
27+
auto size = layout.getTypeSize(scalarAttr.getType());
28+
return createScalarTypeNode(scalarAttr.getId(), getChar(), size);
29+
}
30+
if (auto structAttr = mlir::dyn_cast<cir::TBAAStructAttr>(tbaa)) {
31+
llvm::SmallVector<mlir::LLVM::TBAAMemberAttr, 4> members;
32+
for (const auto &member : structAttr.getMembers()) {
33+
auto memberTypeDesc =
34+
lowerCIRTBAAAttrToLLVMTBAAAttr(member.getTypeDesc());
35+
auto memberAttr = mlir::LLVM::TBAAMemberAttr::get(
36+
mlirContext, memberTypeDesc, member.getOffset());
37+
members.push_back(memberAttr);
38+
}
39+
return mlir::LLVM::TBAATypeDescriptorAttr::get(
40+
mlirContext, structAttr.getId(), members);
41+
}
42+
return nullptr;
43+
}
44+
45+
private:
1946
mlir::LLVM::TBAARootAttr getRoot() {
20-
return mlir::LLVM::TBAARootAttr::get(
21-
mlirContext, mlir::StringAttr::get(mlirContext, "Simple C/C++ TBAA"));
47+
return createTBAARoot("Simple C/C++ TBAA");
2248
}
2349

2450
mlir::LLVM::TBAATypeDescriptorAttr getChar() {
@@ -35,36 +61,35 @@ class CIRToLLVMTBAAAttrLowering {
3561
llvm::ArrayRef<mlir::LLVM::TBAAMemberAttr>(members));
3662
}
3763

38-
protected:
39-
mlir::MLIRContext *mlirContext;
40-
};
41-
42-
class CIRToLLVMTBAAScalarAttrLowering : public CIRToLLVMTBAAAttrLowering {
43-
public:
44-
CIRToLLVMTBAAScalarAttrLowering(mlir::MLIRContext *mlirContext)
45-
: CIRToLLVMTBAAAttrLowering(mlirContext) {}
46-
mlir::LLVM::TBAATypeDescriptorAttr
47-
lowerScalarType(cir::TBAAScalarAttr scalarAttr) {
48-
mlir::DataLayout layout;
49-
auto size = layout.getTypeSize(scalarAttr.getType());
50-
return createScalarTypeNode(scalarAttr.getId(), getChar(), size);
64+
mlir::LLVM::TBAARootAttr createTBAARoot(llvm::StringRef name) {
65+
return mlir::LLVM::TBAARootAttr::get(
66+
mlirContext, mlir::StringAttr::get(mlirContext, name));
5167
}
68+
69+
mlir::MLIRContext *mlirContext;
5270
};
5371

5472
mlir::ArrayAttr lowerCIRTBAAAttr(mlir::Attribute tbaa,
5573
mlir::ConversionPatternRewriter &rewriter,
5674
cir::LowerModule *lowerMod) {
5775
auto *ctx = rewriter.getContext();
58-
CIRToLLVMTBAAScalarAttrLowering scalarLower(ctx);
59-
if (auto charAttr = mlir::dyn_cast<cir::TBAAOmnipotentCharAttr>(tbaa)) {
60-
auto accessType = scalarLower.getChar();
61-
auto tag = mlir::LLVM::TBAATagAttr::get(accessType, accessType, 0);
62-
return mlir::ArrayAttr::get(ctx, {tag});
63-
}
64-
if (auto scalarAttr = mlir::dyn_cast<cir::TBAAScalarAttr>(tbaa)) {
65-
auto accessType = scalarLower.lowerScalarType(scalarAttr);
66-
auto tag = mlir::LLVM::TBAATagAttr::get(accessType, accessType, 0);
67-
return mlir::ArrayAttr::get(ctx, {tag});
76+
CIRToLLVMTBAAAttrLowering lower(ctx);
77+
if (auto tbaaTag = mlir::dyn_cast<cir::TBAATagAttr>(tbaa)) {
78+
mlir::LLVM::TBAATypeDescriptorAttr accessType =
79+
lower.lowerCIRTBAAAttrToLLVMTBAAAttr(tbaaTag.getAccess());
80+
if (auto structAttr =
81+
mlir::dyn_cast<cir::TBAAStructAttr>(tbaaTag.getBase())) {
82+
auto baseType = lower.lowerCIRTBAAAttrToLLVMTBAAAttr(structAttr);
83+
auto tag = mlir::LLVM::TBAATagAttr::get(baseType, accessType,
84+
tbaaTag.getOffset());
85+
return mlir::ArrayAttr::get(ctx, {tag});
86+
}
87+
} else {
88+
auto accessType = lower.lowerCIRTBAAAttrToLLVMTBAAAttr(tbaa);
89+
if (accessType) {
90+
auto tag = mlir::LLVM::TBAATagAttr::get(accessType, accessType, 0);
91+
return mlir::ArrayAttr::get(ctx, {tag});
92+
}
6893
}
6994
return mlir::ArrayAttr();
7095
}

clang/test/CIR/CodeGen/tbaa-struct.cpp

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@
44

55
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir -O1
66
// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s
7+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll -O1 -disable-llvm-passes -no-struct-path-tbaa
8+
// RUN: FileCheck --check-prefix=CHECK --input-file=%t.ll %s
9+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll -O1 -disable-llvm-passes
10+
// RUN: FileCheck --check-prefixes=PATH,OLD-PATH --input-file=%t.ll %s
11+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll -O1 -disable-llvm-passes -relaxed-aliasing
12+
// RUN: FileCheck --check-prefix=NO-TBAA --input-file=%t.ll %s
13+
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o %t.ll -O0 -disable-llvm-passes
14+
// RUN: FileCheck --check-prefix=NO-TBAA --input-file=%t.ll %s
715

16+
// NO-TBAA-NOT: !tbaa
817
// CIR: #tbaa[[NYI:.*]] = #cir.tbaa
918
// CIR: #tbaa[[CHAR:.*]] = #cir.tbaa_omnipotent_char
1019
// CIR: #tbaa[[INT:.*]] = #cir.tbaa_scalar<id = "int", type = !s32i>
@@ -81,6 +90,14 @@ uint32_t g(uint32_t *s, StructA *A, uint64_t count) {
8190
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
8291
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u32i
8392
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u32i, !cir.ptr<!u32i> tbaa(#tbaa[[TAG_StructA_f32]])
93+
94+
95+
// CHECK-LABEL: define{{.*}} i32 @_Z1g
96+
// CHECK: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32:!.*]]
97+
// CHECK: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
98+
// PATH-LABEL: define{{.*}} i32 @_Z1g
99+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32:!.*]]
100+
// PATH: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_A_f32:!.*]]
84101
*s = 1;
85102
A->f32 = 4;
86103
return *s;
@@ -94,6 +111,13 @@ uint32_t g2(uint32_t *s, StructA *A, uint64_t count) {
94111
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
95112
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u16i
96113
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u16i, !cir.ptr<!u16i> tbaa(#tbaa[[TAG_StructA_f16]])
114+
115+
// CHECK-LABEL: define{{.*}} i32 @_Z2g2
116+
// CHECK: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
117+
// CHECK: store i16 4, ptr %{{.*}}, align {{4|2}}, !tbaa [[TAG_i16:!.*]]
118+
// PATH-LABEL: define{{.*}} i32 @_Z2g2
119+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
120+
// PATH: store i16 4, ptr %{{.*}}, align {{4|2}}, !tbaa [[TAG_A_f16:!.*]]
97121
*s = 1;
98122
A->f16 = 4;
99123
return *s;
@@ -107,6 +131,13 @@ uint32_t g3(StructA *A, StructB *B, uint64_t count) {
107131
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
108132
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u32i
109133
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u32i, !cir.ptr<!u32i> tbaa(#tbaa[[TAG_StructB_a_f32]])
134+
135+
// CHECK-LABEL: define{{.*}} i32 @_Z2g3
136+
// CHECK: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
137+
// CHECK: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
138+
// PATH-LABEL: define{{.*}} i32 @_Z2g3
139+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_A_f32]]
140+
// PATH: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_B_a_f32:!.*]]
110141
A->f32 = 1;
111142
B->a.f32 = 4;
112143
return A->f32;
@@ -120,6 +151,13 @@ uint32_t g4(StructA *A, StructB *B, uint64_t count) {
120151
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
121152
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u16i
122153
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u16i, !cir.ptr<!u16i> tbaa(#tbaa[[TAG_StructB_a_f16]])
154+
155+
// LLVM-LABEL: define{{.*}} i32 @_Z2g4
156+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
157+
// LLVM: store i16 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i16]]
158+
// PATH-LABEL: define{{.*}} i32 @_Z2g4
159+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_A_f32]]
160+
// PATH: store i16 4, ptr %{{.*}}, align {{4|2}}, !tbaa [[TAG_B_a_f16:!.*]]
123161
A->f32 = 1;
124162
B->a.f16 = 4;
125163
return A->f32;
@@ -133,6 +171,13 @@ uint32_t g5(StructA *A, StructB *B, uint64_t count) {
133171
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
134172
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u32i
135173
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u32i, !cir.ptr<!u32i> tbaa(#tbaa[[TAG_StructB_f32]])
174+
175+
// LLVM-LABEL: define{{.*}} i32 @_Z2g5
176+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
177+
// LLVM: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
178+
// PATH-LABEL: define{{.*}} i32 @_Z2g5
179+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_A_f32]]
180+
// PATH: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_B_f32:!.*]]
136181
A->f32 = 1;
137182
B->f32 = 4;
138183
return A->f32;
@@ -146,6 +191,13 @@ uint32_t g6(StructA *A, StructB *B, uint64_t count) {
146191
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
147192
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u32i
148193
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u32i, !cir.ptr<!u32i> tbaa(#tbaa[[TAG_StructB_a_f32_2]])
194+
195+
// LLVM-LABEL: define{{.*}} i32 @_Z2g6
196+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
197+
// LLVM: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
198+
// PATH-LABEL: define{{.*}} i32 @_Z2g6
199+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_A_f32]]
200+
// PATH: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_B_a_f32_2:!.*]]
149201
A->f32 = 1;
150202
B->a.f32_2 = 4;
151203
return A->f32;
@@ -159,6 +211,13 @@ uint32_t g7(StructA *A, StructS *S, uint64_t count) {
159211
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
160212
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u32i
161213
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u32i, !cir.ptr<!u32i> tbaa(#tbaa[[TAG_StructS_f32]])
214+
215+
// LLVM-LABEL: define{{.*}} i32 @_Z2g7
216+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
217+
// LLVM: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
218+
// PATH-LABEL: define{{.*}} i32 @_Z2g7
219+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_A_f32]]
220+
// PATH: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_S_f32:!.*]]
162221
A->f32 = 1;
163222
S->f32 = 4;
164223
return A->f32;
@@ -172,6 +231,13 @@ uint32_t g8(StructA *A, StructS *S, uint64_t count) {
172231
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
173232
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u16i
174233
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u16i, !cir.ptr<!u16i> tbaa(#tbaa[[TAG_StructS_f16]])
234+
235+
// LLVM-LABEL: define{{.*}} i32 @_Z2g8
236+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
237+
// LLVM: store i16 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i16]]
238+
// PATH-LABEL: define{{.*}} i32 @_Z2g8
239+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_A_f32]]
240+
// PATH: store i16 4, ptr %{{.*}}, align {{4|2}}, !tbaa [[TAG_S_f16:!.*]]
175241
A->f32 = 1;
176242
S->f16 = 4;
177243
return A->f32;
@@ -185,6 +251,13 @@ uint32_t g9(StructS *S, StructS2 *S2, uint64_t count) {
185251
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
186252
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u32i
187253
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u32i, !cir.ptr<!u32i> tbaa(#tbaa[[TAG_StructS2_f32]])
254+
255+
// LLVM-LABEL: define{{.*}} i32 @_Z2g9
256+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
257+
// LLVM: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
258+
// PATH-LABEL: define{{.*}} i32 @_Z2g9
259+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_S_f32]]
260+
// PATH: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_S2_f32:!.*]]
188261
S->f32 = 1;
189262
S2->f32 = 4;
190263
return S->f32;
@@ -198,6 +271,13 @@ uint32_t g10(StructS *S, StructS2 *S2, uint64_t count) {
198271
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
199272
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u16i
200273
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u16i, !cir.ptr<!u16i> tbaa(#tbaa[[TAG_StructS2_f16]])
274+
275+
// LLVM-LABEL: define{{.*}} i32 @_Z3g10
276+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
277+
// LLVM: store i16 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i16]]
278+
// PATH-LABEL: define{{.*}} i32 @_Z3g10
279+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_S_f32]]
280+
// PATH: store i16 4, ptr %{{.*}}, align {{4|2}}, !tbaa [[TAG_S2_f16:!.*]]
201281
S->f32 = 1;
202282
S2->f16 = 4;
203283
return S->f32;
@@ -211,6 +291,13 @@ uint32_t g11(StructC *C, StructD *D, uint64_t count) {
211291
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
212292
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u32i
213293
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u32i, !cir.ptr<!u32i> tbaa(#tbaa[[TAG_StructD_b_a_f32]])
294+
295+
// LLVM-LABEL: define{{.*}} i32 @_Z3g11
296+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
297+
// LLVM: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
298+
// PATH-LABEL: define{{.*}} i32 @_Z3g11
299+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_C_b_a_f32:!.*]]
300+
// PATH: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_D_b_a_f32:!.*]]
214301
C->b.a.f32 = 1;
215302
D->b.a.f32 = 4;
216303
return C->b.a.f32;
@@ -224,6 +311,14 @@ uint32_t g12(StructC *C, StructD *D, uint64_t count) {
224311
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
225312
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u32i
226313
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u32i, !cir.ptr<!u32i> tbaa(#tbaa[[TAG_StructB_a_f32]])
314+
315+
// LLVM-LABEL: define{{.*}} i32 @_Z3g12
316+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
317+
// LLVM: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
318+
// TODO(cir): differentiate the two accesses.
319+
// PATH-LABEL: define{{.*}} i32 @_Z3g12
320+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_B_a_f32]]
321+
// PATH: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_B_a_f32]]
227322
StructB *b1 = &(C->b);
228323
StructB *b2 = &(D->b);
229324
// b1, b2 have different context.
@@ -243,6 +338,11 @@ char g14(struct six *a, struct six *b) {
243338
// CIR: %[[TMP1:.*]] = cir.load %{{.*}} : !cir.ptr<!cir.ptr<!ty_six>>, !cir.ptr<!ty_six>
244339
// CIR: %[[TMP2:.*]] = cir.get_member %[[TMP1]][2] {name = "b"} : !cir.ptr<!ty_six> -> !cir.ptr<!s8i>
245340
// CIR: %[[TMP3:.*]] = cir.load %[[TMP2]] : !cir.ptr<!s8i>, !s8i tbaa(#tbaa[[TAG_six_b]])
341+
342+
// LLVM-LABEL: define{{.*}} i8 @_Z3g14
343+
// LLVM: load i8, ptr %{{.*}}, align 1, !tbaa [[TAG_char]]
344+
// PATH-LABEL: define{{.*}} i8 @_Z3g14
345+
// PATH: load i8, ptr %{{.*}}, align 1, !tbaa [[TAG_six_b:!.*]]
246346
return a->b;
247347
}
248348

@@ -256,7 +356,49 @@ uint32_t g15(StructS *S, StructS3 *S3, uint64_t count) {
256356
// CIR: %[[INT_4:.*]] = cir.const #cir.int<4> : !s32i
257357
// CIR: %[[UINT_4:.*]] = cir.cast(integral, %[[INT_4]] : !s32i), !u32i
258358
// CIR: cir.store %[[UINT_4]], %{{.*}} : !u32i, !cir.ptr<!u32i> tbaa(#tbaa[[TAG_StructS_f32]])
359+
360+
361+
// LLVM-LABEL: define{{.*}} i32 @_Z3g15
362+
// LLVM: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
363+
// LLVM: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_i32]]
364+
// PATH-LABEL: define{{.*}} i32 @_Z3g15
365+
// PATH: store i32 1, ptr %{{.*}}, align 4, !tbaa [[TAG_S_f32]]
366+
// PATH: store i32 4, ptr %{{.*}}, align 4, !tbaa [[TAG_S_f32]]
259367
S->f32 = 1;
260368
S3->f32 = 4;
261369
return S->f32;
262370
}
371+
372+
// LLVM: [[TYPE_char:!.*]] = !{!"omnipotent char", [[TAG_cxx_tbaa:!.*]],
373+
// LLVM: [[TAG_cxx_tbaa]] = !{!"Simple C++ TBAA"}
374+
// LLVM: [[TAG_i32]] = !{[[TYPE_i32:!.*]], [[TYPE_i32]], i64 0}
375+
// LLVM: [[TYPE_i32]] = !{!"int", [[TYPE_char]],
376+
// LLVM: [[TAG_i16]] = !{[[TYPE_i16:!.*]], [[TYPE_i16]], i64 0}
377+
// LLVM: [[TYPE_i16]] = !{!"short", [[TYPE_char]],
378+
// LLVM: [[TAG_char]] = !{[[TYPE_char]], [[TYPE_char]], i64 0}
379+
380+
// OLD-PATH: [[TAG_i32]] = !{[[TYPE_INT:!.*]], [[TYPE_INT]], i64 0}
381+
// OLD-PATH: [[TYPE_INT]] = !{!"int", [[TYPE_CHAR:!.*]], i64 0}
382+
// OLD-PATH: [[TYPE_CHAR]] = !{!"omnipotent char", [[TAG_cxx_tbaa:!.*]],
383+
// OLD-PATH: [[TAG_cxx_tbaa]] = !{!"Simple C/C++ TBAA"}
384+
// OLD-PATH: [[TAG_A_f32]] = !{[[TYPE_A:!.*]], [[TYPE_INT]], i64 4}
385+
// OLD-PATH: [[TYPE_A]] = !{!"_ZTS7StructA", [[TYPE_SHORT:!.*]], i64 0, [[TYPE_INT]], i64 4, [[TYPE_SHORT]], i64 8, [[TYPE_INT]], i64 12}
386+
// OLD-PATH: [[TYPE_SHORT:!.*]] = !{!"short", [[TYPE_CHAR]]
387+
// OLD-PATH: [[TAG_A_f16]] = !{[[TYPE_A]], [[TYPE_SHORT]], i64 0}
388+
// OLD-PATH: [[TAG_B_a_f32]] = !{[[TYPE_B:!.*]], [[TYPE_INT]], i64 8}
389+
// OLD-PATH: [[TYPE_B]] = !{!"_ZTS7StructB", [[TYPE_SHORT]], i64 0, [[TYPE_A]], i64 4, [[TYPE_INT]], i64 20}
390+
// OLD-PATH: [[TAG_B_a_f16]] = !{[[TYPE_B]], [[TYPE_SHORT]], i64 4}
391+
// OLD-PATH: [[TAG_B_f32]] = !{[[TYPE_B]], [[TYPE_INT]], i64 20}
392+
// OLD-PATH: [[TAG_B_a_f32_2]] = !{[[TYPE_B]], [[TYPE_INT]], i64 16}
393+
// OLD-PATH: [[TAG_S_f32]] = !{[[TYPE_S:!.*]], [[TYPE_INT]], i64 4}
394+
// OLD-PATH: [[TYPE_S]] = !{!"_ZTS7StructS", [[TYPE_SHORT]], i64 0, [[TYPE_INT]], i64 4}
395+
// OLD-PATH: [[TAG_S_f16]] = !{[[TYPE_S]], [[TYPE_SHORT]], i64 0}
396+
// OLD-PATH: [[TAG_S2_f32]] = !{[[TYPE_S2:!.*]], [[TYPE_INT]], i64 4}
397+
// OLD-PATH: [[TYPE_S2]] = !{!"_ZTS8StructS2", [[TYPE_SHORT]], i64 0, [[TYPE_INT]], i64 4}
398+
// OLD-PATH: [[TAG_S2_f16]] = !{[[TYPE_S2]], [[TYPE_SHORT]], i64 0}
399+
// OLD-PATH: [[TAG_C_b_a_f32]] = !{[[TYPE_C:!.*]], [[TYPE_INT]], i64 12}
400+
// OLD-PATH: [[TYPE_C]] = !{!"_ZTS7StructC", [[TYPE_SHORT]], i64 0, [[TYPE_B]], i64 4, [[TYPE_INT]], i64 28}
401+
// OLD-PATH: [[TAG_D_b_a_f32]] = !{[[TYPE_D:!.*]], [[TYPE_INT]], i64 12}
402+
// OLD-PATH: [[TYPE_D]] = !{!"_ZTS7StructD", [[TYPE_SHORT]], i64 0, [[TYPE_B]], i64 4, [[TYPE_INT]], i64 28, [[TYPE_CHAR]], i64 32}
403+
// OLD-PATH: [[TAG_six_b]] = !{[[TYPE_six:!.*]], [[TYPE_CHAR]], i64 4}
404+
// OLD-PATH: [[TYPE_six]] = !{!"_ZTS3six", [[TYPE_CHAR]], i64 0, [[TYPE_CHAR]], i64 4, [[TYPE_CHAR]], i64 5}

0 commit comments

Comments
 (0)