diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-12-05 22:23:28 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-12-05 22:23:28 +0000 |
commit | bd7d82878c1588afccbee6c68fa6e17bbbab7f2c (patch) | |
tree | de31b4dfa1b8acb9bddff992dc5db54b154609dd /test | |
parent | da5f2d2360ace0ea32e4f3194906be4899a76c7d (diff) |
Make EmitAggregateCopy take an alignment argument. Make EmitFinalDestCopy pass in the correct alignment when known.
The test includes a FIXME for a related case involving calls; it's a bit more complicated to fix because the RValue class doesn't keep track of alignment.
<rdar://problem/10463337>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145862 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGen/packed-nest-unpacked.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/CodeGen/packed-nest-unpacked.c b/test/CodeGen/packed-nest-unpacked.c new file mode 100644 index 0000000000..af1508ae81 --- /dev/null +++ b/test/CodeGen/packed-nest-unpacked.c @@ -0,0 +1,31 @@ +// RUN: %clang_cc1 %s -triple x86_64-apple-macosx10.7.2 -emit-llvm -o - | FileCheck %s +// <rdar://problem/10463337> + +struct X { int x[6]; }; +struct Y { char x[13]; struct X y; } __attribute((packed)); +struct Y g; +void f(struct X); + +struct X test1() { + // CHECK: @test1 + // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* bitcast (%struct.X* getelementptr inbounds (%struct.Y* @g, i32 0, i32 1) to i8*), i64 24, i32 1, i1 false) + return g.y; +} +struct X test2() { + // CHECK: @test2 + // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* bitcast (%struct.X* getelementptr inbounds (%struct.Y* @g, i32 0, i32 1) to i8*), i64 24, i32 1, i1 false) + struct X a = g.y; + return a; +} + +void test3(struct X a) { + // CHECK: @test3 + // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* bitcast (%struct.X* getelementptr inbounds (%struct.Y* @g, i32 0, i32 1) to i8*), i8* {{.*}}, i64 24, i32 1, i1 false) + g.y = a; +} + +void test4() { + // CHECK: @test4 + // FIXME: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* bitcast (%struct.X* getelementptr inbounds (%struct.Y* @g, i32 0, i32 1) to i8*), i64 24, i32 1, i1 false) + f(g.y); +} |