summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-05-02 20:24:29 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-05-02 20:24:29 +0000
commit30458b51e385e1cd747d7c4a6eb1ebefe0c89772 (patch)
treefa1e59c64a2edaab7b4295f5873a59c891df63f6 /clang/test
parent39b56b4b9f562aded08846ad53c57c378fb2078b (diff)
downloadbcm5719-llvm-30458b51e385e1cd747d7c4a6eb1ebefe0c89772.tar.gz
bcm5719-llvm-30458b51e385e1cd747d7c4a6eb1ebefe0c89772.zip
Skip extra copy from aggregate where it isn't necessary; rdar://problem/8139919 . This shouldn't make much of a difference at -O3, but should substantially reduce the number of generated memcpy's at -O0.
llvm-svn: 130717
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CodeGen/byval-memcpy-elim.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGen/byval-memcpy-elim.c b/clang/test/CodeGen/byval-memcpy-elim.c
new file mode 100644
index 00000000000..8aa08fb07b2
--- /dev/null
+++ b/clang/test/CodeGen/byval-memcpy-elim.c
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin10 < %s | FileCheck %s
+
+struct Test1S {
+ long NumDecls;
+ long X;
+ long Y;
+};
+struct Test2S {
+ long NumDecls;
+ long X;
+};
+
+// Make sure we don't generate extra memcpy for lvalues
+void test1a(struct Test1S, struct Test2S);
+// CHECK: define void @test1(
+// CHECK-NOT: memcpy
+// CHECK: call void @test1a
+void test1(struct Test1S *A, struct Test2S *B) {
+ test1a(*A, *B);
+}
OpenPOWER on IntegriCloud