diff options
author | John McCall <rjmccall@apple.com> | 2012-03-28 23:30:44 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-03-28 23:30:44 +0000 |
commit | 57cd1b89cd91433ce1991a5bff36fe776a263796 (patch) | |
tree | 9d65d25e15649b8487c5a4e9fda2910c1a7dce74 /test/CodeGenCXX/assign-operator.cpp | |
parent | b684a42154a555206a33ac47a52ad2a306cfa2b4 (diff) |
When we can't prove that the target of an aggregate copy is
a complete object, the memcpy needs to use the data size of
the structure instead of its sizeof() value. Fixes PR12204.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153613 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/assign-operator.cpp')
-rw-r--r-- | test/CodeGenCXX/assign-operator.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGenCXX/assign-operator.cpp b/test/CodeGenCXX/assign-operator.cpp index e19df272c9..00058a2ed5 100644 --- a/test/CodeGenCXX/assign-operator.cpp +++ b/test/CodeGenCXX/assign-operator.cpp @@ -28,3 +28,24 @@ namespace test1 { A<int> a; } + +// PR12204 +namespace test2 { + struct A { + A() {} // make this non-POD to enable tail layout + void *ptr; + char c; + }; + + void test(A &out) { + out = A(); + } +} +// CHECK: define void @_ZN5test24testERNS_1AE( +// CHECK: [[OUT:%.*]] = alloca [[A:%.*]]*, align 8 +// CHECK-NEXT: [[TMP:%.*]] = alloca [[A]], align 8 +// CHECK: [[REF:%.*]] = load [[A]]** [[OUT]], align 8 +// CHECK-NEXT: call void @_ZN5test21AC1Ev([[A]]* [[TMP]]) +// CHECK-NEXT: [[T0:%.*]] = bitcast [[A]]* [[REF]] to i8* +// CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[TMP]] to i8* +// CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[T0]], i8* [[T1]], i64 9, i32 8, i1 false) |