Skip to content

Commit e561a2e

Browse files
committed
[TBAA] Add run-line with -fpointer-tbaa to cwg158
1 parent c97478c commit e561a2e

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

clang/test/CXX/drs/cwg158.cpp

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
// RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
2-
// RUN: %clang_cc1 -triple x86_64-linux -std=c++11 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
3-
// RUN: %clang_cc1 -triple x86_64-linux -std=c++14 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
4-
// RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck %s
1+
// RUN: %clang_cc1 -triple x86_64-linux -std=c++98 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK,DEFAULT %s
2+
// RUN: %clang_cc1 -triple x86_64-linux -std=c++11 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK,DEFAULT %s
3+
// RUN: %clang_cc1 -triple x86_64-linux -std=c++14 %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK,DEFAULT %s
4+
// RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK,DEFAULT %s
5+
// RUN: %clang_cc1 -triple x86_64-linux -std=c++1z %s -O3 -pointer-tbaa -disable-llvm-passes -pedantic-errors -emit-llvm -o - | FileCheck --check-prefixes=CHECK,POINTER-TBAA %s
56

67
// cwg158: yes
78

89
// CHECK-LABEL: define {{.*}} @_Z1f
910
const int *f(const int * const *p, int **q) {
11+
// CHECK: load ptr, ptr %p.addr
1012
// CHECK: load ptr, {{.*}}, !tbaa ![[INTPTR_TBAA:[^,]*]]
1113
const int *x = *p;
1214
// CHECK: store ptr null, {{.*}}, !tbaa ![[INTPTR_TBAA]]
@@ -18,10 +20,24 @@ struct A {};
1820

1921
// CHECK-LABEL: define {{.*}} @_Z1g
2022
const int *(A::*const *g(const int *(A::* const **p)[3], int *(A::***q)[3]))[3] {
23+
// CHECK: load ptr, ptr %p.addr
2124
// CHECK: load ptr, {{.*}}, !tbaa ![[MEMPTR_TBAA:[^,]*]]
2225
const int *(A::*const *x)[3] = *p;
23-
// CHECK: store ptr null, {{.*}}, !tbaa ![[MEMPTR_TBAA]]
26+
// DEFAULT: store ptr null, {{.*}}, !tbaa ![[MEMPTR_TBAA]]
27+
// POINTER-TBAA-NOT: store ptr null, {{.*}}, !tbaa ![[MEMPTR_TBAA]]
2428
*q = 0;
2529
return x;
2630
}
2731

32+
// CHECK-LABEL: define {{.*}} @_Z1h
33+
const int * h(const int * (*p)[10], int *(*q)[9]) {
34+
// CHECK: load ptr, ptr %p.addr, align 8, !tbaa [[PTRARRAY_TBAA:!.+]]
35+
const int * x = *p[0];
36+
37+
// CHECK: load ptr, ptr %q.addr, align 8, !tbaa [[PTRARRAY_TBAA]]
38+
*q[0] = 0;
39+
return x;
40+
}
41+
42+
// POINTER-TBAA: [[PTRARRAY_TBAA]] = !{[[PTRARRAY_TY:!.+]], [[PTRARRAY_TY]], i64 0}
43+
// POINTER-TBAA: [[PTRARRAY_TY:!.+]] = !{!"p1 _ZTSPi", !4, i64 0}

0 commit comments

Comments
 (0)