@@ -13,6 +13,12 @@ struct C { int i; int x[3]; };
1313struct D { int n; int arr[]; }; // flexible array member
1414extern int AA[]; // incomplete array type
1515
16+ typedef int __attribute__ ((may_alias)) aliasing_int;
17+ typedef int __attribute__ ((may_alias)) aliasing_array[10];
18+ struct E {
19+ aliasing_int x[4 ]; aliasing_array y;
20+ };
21+
1622int foo (B *b) {
1723// CHECK-LABEL: _Z3fooP1B
1824// CHECK: load i32, {{.*}}, !tbaa [[TAG_A_i:!.*]]
@@ -54,6 +60,18 @@ int bar5(int j) {
5460 return AA[2 ] + AA[j];
5561}
5662
63+ int bar6 (E *e, int j) {
64+ // CHECK-NEW-LABEL: _Z4bar6P1Ei
65+ // CHECK-NEW: load i32, {{.*}}, !tbaa [[TAG_E_x:!.*]]
66+ return e->x [j];
67+ }
68+
69+ int bar7 (E *e, int j) {
70+ // CHECK-NEW-LABEL: _Z4bar7P1Ei
71+ // CHECK-NEW: load i32, {{.*}}, !tbaa [[TAG_E_y:!.*]]
72+ return e->y [j];
73+ }
74+
5775// CHECK-DAG: [[TAG_A_i]] = !{[[TYPE_A:!.*]], [[TYPE_int:!.*]], i64 0}
5876// CHECK-DAG: [[TYPE_A]] = !{!"_ZTS1A", !{{.*}}, i64 0}
5977// CHECK-DAG: [[TYPE_int]] = !{!"int", !{{.*}}, i64 0}
@@ -64,5 +82,8 @@ int bar5(int j) {
6482// CHECK-NEW-DAG: [[TYPE_A:!.*]] = !{[[TYPE_char]], i64 4, !"_ZTS1A", [[TYPE_int]], i64 0, i64 4}
6583// CHECK-NEW-DAG: [[TAG_A_i]] = !{[[TYPE_A]], [[TYPE_int]], i64 0, i64 4}
6684// CHECK-NEW-DAG: [[TYPE_C:!.*]] = !{[[TYPE_char]], i64 16, !"_ZTS1C", [[TYPE_int]], i64 0, i64 4, [[TYPE_int]], i64 4, i64 12}
67- // CHECK-NEW-DAG: [[TAG_C_i]] = !{[[TYPE_C:!.*]], [[TYPE_int:!.*]], i64 0, i64 4}
68- // CHECK-NEW-DAG: [[TAG_C_x]] = !{[[TYPE_C:!.*]], [[TYPE_int:!.*]], i64 4, i64 4}
85+ // CHECK-NEW-DAG: [[TAG_C_i]] = !{[[TYPE_C]], [[TYPE_int]], i64 0, i64 4}
86+ // CHECK-NEW-DAG: [[TAG_C_x]] = !{[[TYPE_C]], [[TYPE_int]], i64 4, i64 4}
87+ // CHECK-NEW-DAG: [[TYPE_E:!.*]] = !{[[TYPE_char]], i64 56, !"_ZTS1E", [[TYPE_char]], i64 0, i64 16, [[TYPE_char]], i64 16, i64 40}
88+ // CHECK-NEW-DAG: [[TAG_E_x]] = !{[[TYPE_E]], [[TYPE_char]], i64 0, i64 4}
89+ // CHECK-NEW-DAG: [[TAG_E_y]] = !{[[TYPE_E]], [[TYPE_char]], i64 16, i64 4}
0 commit comments