[PATCH] D41399: [CodeGen] Represent array members in new-format TBAA type descriptors

Hal Finkel via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 19 18:13:35 PST 2017

hfinkel added inline comments.

Comment at: test/CodeGen/tbaa-array.cpp:24
+// CHECK-DAG: [[TAG_A_i]] = !{[[TYPE_A:!.*]], [[TYPE_int:!.*]], i64 0, i64 4}
+// CHECK-DAG: [[TAG_C_i]] = !{[[TYPE_C:!.*]], [[TYPE_int:!.*]], i64 0, i64 16}
+// CHECK-DAG: [[TYPE_A]] = !{[[TYPE_char:!.*]], i64 4, !"_ZTS1A", [[TYPE_int]], i64 0, i64 4}
Shouldn't this access have a size of 4, and an access for c->x[2] have a size of 4 and a specific offset and c->x[j] have a size of 12 and an offset of zero? Why does this list a size of 16?

In any case, please add tests for:

  int *bar2(C *c) {
    return c->x;

  int bar3(C *c) {
    return c->x[2];

  int bar4(C *c, int j) {
    return c->x[j];



More information about the cfe-commits mailing list