[ELF] Reorder SectionBase/InputSectionBase members
[llvm-project.git] / clang / test / CodeGen / may-alias.c
blobcba62af4bb925668caa96e725f5542065e8ac8a9
1 // RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1 \
2 // RUN: -no-struct-path-tbaa -disable-llvm-passes -o - %s | \
3 // RUN: FileCheck -allow-deprecated-dag-overlap %s -check-prefixes=CHECK,SCALAR
4 // RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1 \
5 // RUN: -disable-llvm-passes -o - %s | \
6 // RUN: FileCheck -allow-deprecated-dag-overlap %s -check-prefixes=CHECK,OLD-PATH
7 // RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1 \
8 // RUN: -new-struct-path-tbaa -disable-llvm-passes -o - %s | \
9 // RUN: FileCheck -allow-deprecated-dag-overlap %s -check-prefixes=CHECK,NEW-PATH
11 // Types with the may_alias attribute should be considered equivalent
12 // to char for aliasing.
14 typedef int __attribute__((may_alias)) aliasing_int;
16 void test0(aliasing_int *ai, int *i) {
17 // CHECK-LABEL: test0
18 // CHECK: store i32 0, {{.*}}, !tbaa [[TAG_alias_int:!.*]]
19 *ai = 0;
21 // CHECK: store i32 1, {{.*}}, !tbaa [[TAG_int:!.*]]
22 *i = 1;
25 // PR9307
26 struct Test1 { int x; };
27 struct Test1MA { int x; } __attribute__((may_alias));
28 void test1(struct Test1MA *p1, struct Test1 *p2) {
29 // CHECK-LABEL: test1
30 // CHECK: store i32 2, {{.*}}, !tbaa [[TAG_alias_test1_x:!.*]]
31 p1->x = 2;
33 // CHECK: store i32 3, {{.*}}, !tbaa [[TAG_test1_x:!.*]]
34 p2->x = 3;
37 // SCALAR-DAG: [[ROOT:!.*]] = !{!"Simple C/C++ TBAA"}
38 // SCALAR-DAG: [[TYPE_char:!.*]] = !{!"omnipotent char", [[ROOT]], i64 0}
39 // SCALAR-DAG: [[TAG_alias_int]] = !{[[TYPE_char]], [[TYPE_char]], i64 0}
40 // SCALAR-DAG: [[TAG_alias_test1_x]] = !{[[TYPE_char]], [[TYPE_char]], i64 0}
41 // SCALAR-DAG: [[TYPE_int:!.*]] = !{!"int", [[TYPE_char]], i64 0}
42 // SCALAR-DAG: [[TAG_int]] = !{[[TYPE_int]], [[TYPE_int]], i64 0}
43 // SCALAR-DAG: [[TAG_test1_x]] = !{[[TYPE_int]], [[TYPE_int]], i64 0}
45 // OLD-PATH-DAG: [[ROOT:!.*]] = !{!"Simple C/C++ TBAA"}
46 // OLD-PATH-DAG: [[TYPE_char:!.*]] = !{!"omnipotent char", [[ROOT]], i64 0}
47 // OLD-PATH-DAG: [[TAG_alias_int]] = !{[[TYPE_char]], [[TYPE_char]], i64 0}
48 // OLD-PATH-DAG: [[TAG_alias_test1_x]] = !{[[TYPE_char]], [[TYPE_char]], i64 0}
49 // OLD-PATH-DAG: [[TYPE_int:!.*]] = !{!"int", [[TYPE_char]], i64 0}
50 // OLD-PATH-DAG: [[TAG_int]] = !{[[TYPE_int]], [[TYPE_int]], i64 0}
51 // OLD-PATH-DAG: [[TYPE_test1:!.*]] = !{!"Test1", [[TYPE_int]], i64 0}
52 // OLD-PATH-DAG: [[TAG_test1_x]] = !{[[TYPE_test1]], [[TYPE_int]], i64 0}
54 // NEW-PATH-DAG: [[ROOT:!.*]] = !{!"Simple C/C++ TBAA"}
55 // NEW-PATH-DAG: [[TYPE_char:!.*]] = !{[[ROOT]], i64 1, !"omnipotent char"}
56 // NEW-PATH-DAG: [[TAG_alias_int]] = !{[[TYPE_char]], [[TYPE_char]], i64 0, i64 0}
57 // NEW-PATH-DAG: [[TAG_alias_test1_x]] = !{[[TYPE_char]], [[TYPE_char]], i64 0, i64 0}
58 // NEW-PATH-DAG: [[TYPE_int:!.*]] = !{[[TYPE_char]], i64 4, !"int"}
59 // NEW-PATH-DAG: [[TAG_int]] = !{[[TYPE_int]], [[TYPE_int]], i64 0, i64 4}
60 // NEW-PATH-DAG: [[TYPE_test1:!.*]] = !{[[TYPE_char]], i64 4, !"Test1", [[TYPE_int]], i64 0, i64 4}
61 // NEW-PATH-DAG: [[TAG_test1_x]] = !{[[TYPE_test1]], [[TYPE_int]], i64 0, i64 4}