[PATCH] D41399: [CodeGen] Represent array members in new-format TBAA type descriptors
Ivan Kosarev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 20 08:47:44 PST 2017
kosarev 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}
----------------
kosarev wrote:
> hfinkel wrote:
> > 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];
> > }
> >
> Indeed, the access size is wrong as we mistakenly inherit it from the base type. D41452 fixes this. Thanks for catching.
Hal, in bar2() we don't really access memory. What do we want to check with it?
Repository:
rL LLVM
https://reviews.llvm.org/D41399
More information about the cfe-commits
mailing list