[cfe-commits] r164853 - in /cfe/trunk: lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h lib/CodeGen/CodeGenTBAA.cpp lib/CodeGen/CodeGenTBAA.h test/CodeGen/tbaa-struct.cpp

NAKAMURA Takumi geek4civic at gmail.com
Fri Sep 28 19:04:31 PDT 2012


2012/9/29 Dan Gohman <gohman at apple.com>:
> Author: djg
> Date: Fri Sep 28 16:58:29 2012
> New Revision: 164853
>
> URL: http://llvm.org/viewvc/llvm-project?rev=164853&view=rev
> Log:
> Add basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
> struct assignment.

> Added: cfe/trunk/test/CodeGen/tbaa-struct.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/tbaa-struct.cpp?rev=164853&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGen/tbaa-struct.cpp (added)
> +++ cfe/trunk/test/CodeGen/tbaa-struct.cpp Fri Sep 28 16:58:29 2012
> @@ -0,0 +1,16 @@
> +// RUN: %clang_cc1 -emit-llvm -o - -O1 %s | FileCheck %s
> +//
> +// Check that we generate !tbaa.struct metadata for struct copies.
> +struct A {
> +  short s;
> +  int i;
> +  char c;
> +  int j;
> +};
> +
> +void copy(struct A *a, struct A *b) {
> +  *a = *b;
> +}
> +
> +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.*}}, i8* %{{.*}}, i64 16, i32 4, i1 false), !tbaa.struct [[TS:!.*]]
> +// CHECK: [[TS]] = metadata !{i64 0, i64 2, metadata !{{.*}}, i64 4, i64 4, metadata !{{.*}}, i64 8, i64 1, metadata !{{.*}}, i64 12, i64 4, metadata !{{.*}}}

It fails on 32-bit targets. Tweaked in r164879.



More information about the cfe-commits mailing list