blob: af1508ae81de98d5be7e991bc6e6ce1f02b6ac27 [file] [log] [blame]
Eli Friedmanbd7d8282011-12-05 22:23:28 +00001// RUN: %clang_cc1 %s -triple x86_64-apple-macosx10.7.2 -emit-llvm -o - | FileCheck %s
2// <rdar://problem/10463337>
3
4struct X { int x[6]; };
5struct Y { char x[13]; struct X y; } __attribute((packed));
6struct Y g;
7void f(struct X);
8
9struct X test1() {
10 // CHECK: @test1
11 // 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)
12 return g.y;
13}
14struct X test2() {
15 // CHECK: @test2
16 // 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)
17 struct X a = g.y;
18 return a;
19}
20
21void test3(struct X a) {
22 // CHECK: @test3
23 // 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)
24 g.y = a;
25}
26
27void test4() {
28 // CHECK: @test4
29 // 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)
30 f(g.y);
31}