fix the clang side of PR7437: EmitAggregateCopy
was not producing a memcpy with the right address
spaces because of two places in it doing casts of
the arguments to i8, one of which that didn't
preserve the address space.
There is also an optimizer bug here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107842 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/address-space.c b/test/CodeGen/address-space.c
index 354f58b..1545e8f 100644
--- a/test/CodeGen/address-space.c
+++ b/test/CodeGen/address-space.c
@@ -30,3 +30,15 @@
*A = *B;
}
+// PR7437
+typedef struct {
+ float aData[1];
+} MyStruct;
+
+// CHECK: define void @test4(
+// CHECK: call void @llvm.memcpy.p0i8.p2i8.i64
+// CHECK: call void @llvm.memcpy.p2i8.p0i8.i64
+void test4(MyStruct __attribute__((address_space(2))) *pPtr) {
+ MyStruct s = pPtr[0];
+ pPtr[0] = s;
+}