implement rdar://7346691 by codegen'ing struct/array initializers
to a memset or a memcpy from a global when possible.

llvm-svn: 90658
diff --git a/clang/test/CodeGen/cast-to-union.c b/clang/test/CodeGen/cast-to-union.c
index 1f7e045..b1019da 100644
--- a/clang/test/CodeGen/cast-to-union.c
+++ b/clang/test/CodeGen/cast-to-union.c
@@ -1,7 +1,6 @@
 // RUN: clang-cc -emit-llvm  %s -o - | FileCheck %s
 // CHECK: w = global %0 { i32 2, [4 x i8] undef }
 // CHECK: y = global %union.u { double 7.300000e+0{{[0]*}}1 }
-// CHECK: store i32 351, i32
 
 union u { int i; double d; };
 
diff --git a/clang/test/CodeGen/decl.c b/clang/test/CodeGen/decl.c
index e2d55ec..b268431 100644
--- a/clang/test/CodeGen/decl.c
+++ b/clang/test/CodeGen/decl.c
@@ -1,6 +1,9 @@
 // RUN: clang-cc -emit-llvm < %s | FileCheck %s
 
 // CHECK: @test1.x = internal constant [12 x i32] [i32 1
+// CHECK: @test2.x = internal constant [13 x i32] [i32 1,
+
+#include <string.h>
 
 void test1() {
   // This should codegen as a "@test1.x" global.
@@ -10,3 +13,28 @@
 // CHECK: @test1()
 // CHECK: {{call.*@foo.*@test1.x}}
 }
+
+
+// rdar://7346691
+void test2() {
+  // This should codegen as a "@test2.x" global + memcpy.
+  int x[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23, 24 };
+  foo(x);
+  
+  // CHECK: @test2()
+  // CHECK: %x = alloca [13 x i32]
+  // CHECK: call void @llvm.memcpy
+  // CHECK: call{{.*}}@foo{{.*}}i32* %
+}
+
+
+void test3() {
+  // This should codegen as a "@test3.x" global + memcpy.
+  int x[100] = { 0 };
+  foo(x);
+  
+  // CHECK: @test3()
+  // CHECK: %x = alloca [100 x i32]
+  // CHECK: call void @llvm.memset
+}
+
diff --git a/clang/test/CodeGen/string-init.c b/clang/test/CodeGen/string-init.c
index 0cb6aff..410a407 100644
--- a/clang/test/CodeGen/string-init.c
+++ b/clang/test/CodeGen/string-init.c
@@ -1,5 +1,5 @@
 // RUN: clang-cc -emit-llvm %s -o %t
-// RUN: grep 'private constant \[10 x i8\]' %t
+// RUN: grep 'internal constant \[10 x i8\]' %t
 // RUN: not grep -F "[5 x i8]" %t
 // RUN: not grep "store " %t