[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)
Florian Hahn via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 21 10:48:42 PST 2024
================
@@ -18,10 +20,23 @@ struct A {};
// CHECK-LABEL: define {{.*}} @_Z1g
const int *(A::*const *g(const int *(A::* const **p)[3], int *(A::***q)[3]))[3] {
+ // CHECK: load ptr, ptr %p.addr
// CHECK: load ptr, {{.*}}, !tbaa ![[MEMPTR_TBAA:[^,]*]]
const int *(A::*const *x)[3] = *p;
// CHECK: store ptr null, {{.*}}, !tbaa ![[MEMPTR_TBAA]]
*q = 0;
return x;
}
+// CHECK-LABEL: define {{.*}} @_Z1h
+const int * h(const int * (*p)[10], int *(*q)[9]) {
+ // CHECK: load ptr, ptr %p.addr, align 8, !tbaa [[PTRARRAY_TBAA:!.+]]
+ const int * x = *p[0];
+
+ // CHECK: load ptr, ptr %q.addr, align 8, !tbaa [[PTRARRAY_TBAA]]
+ *q[0] = 0;
+ return x;
+}
+
+// POINTER-TBAA: [[PTRARRAY_TBAA]] = !{[[PTRARRAY_TY:!.+]], [[PTRARRAY_TY]], i64 0}
+// POINTER-TBAA: [[PTRARRAY_TY]] = !{!"p3 int", !4, i64 0}
----------------
fhahn wrote:
The RUN line with `-fpointer-tbaa` was missing the POINTER-TBAA prefix, adjusted and fixed.
https://github.com/llvm/llvm-project/pull/116991
More information about the cfe-commits
mailing list