1 // RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1 -no-struct-path-tbaa -disable-llvm-passes -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -Werror -triple i386-unknown-unknown -emit-llvm -O1 -disable-llvm-passes -o - %s | FileCheck %s -check-prefix=PATH
4 // Types with the may_alias attribute should be considered equivalent
5 // to char for aliasing.
7 typedef int __attribute__((may_alias)) aliasing_int;
9 void test0(aliasing_int *ai, int *i)
11 // CHECK: store i32 0, i32* %{{.*}}, !tbaa [[TAG_CHAR:!.*]]
12 // PATH: store i32 0, i32* %{{.*}}, !tbaa [[TAG_CHAR:!.*]]
14 // CHECK: store i32 1, i32* %{{.*}}, !tbaa [[TAG_INT:!.*]]
15 // PATH: store i32 1, i32* %{{.*}}, !tbaa [[TAG_INT:!.*]]
20 struct Test1 { int x; };
21 struct Test1MA { int x; } __attribute__((may_alias));
22 void test1(struct Test1MA *p1, struct Test1 *p2) {
23 // CHECK: store i32 2, i32* {{%.*}}, !tbaa [[TAG_CHAR]]
24 // PATH: store i32 2, i32* {{%.*}}, !tbaa [[TAG_CHAR]]
26 // CHECK: store i32 3, i32* {{%.*}}, !tbaa [[TAG_INT]]
27 // PATH: store i32 3, i32* {{%.*}}, !tbaa [[TAG_test1_x:!.*]]
30 // CHECK: !"any pointer", [[TYPE_CHAR:!.*]],
31 // CHECK: [[TYPE_CHAR]] = !{!"omnipotent char", [[TAG_CXX_TBAA:!.*]],
32 // CHECK: [[TAG_CXX_TBAA]] = !{!"Simple C/C++ TBAA"}
33 // CHECK: [[TAG_CHAR]] = !{[[TYPE_CHAR]], [[TYPE_CHAR]], i64 0}
34 // CHECK: [[TAG_INT]] = !{[[TYPE_INT:!.*]], [[TYPE_INT]], i64 0}
35 // CHECK: [[TYPE_INT]] = !{!"int", [[TYPE_CHAR]]
37 // PATH: [[TYPE_CHAR:!.*]] = !{!"omnipotent char", !{{.*}}
38 // PATH: [[TAG_CHAR]] = !{[[TYPE_CHAR]], [[TYPE_CHAR]], i64 0}
39 // PATH: [[TAG_INT]] = !{[[TYPE_INT:!.*]], [[TYPE_INT]], i64 0}
40 // PATH: [[TYPE_INT]] = !{!"int", [[TYPE_CHAR]]
41 // PATH: [[TAG_test1_x]] = !{[[TYPE_test1:!.*]], [[TYPE_INT]], i64 0}
42 // PATH: [[TYPE_test1]] = !{!"Test1", [[TYPE_INT]], i64 0}