Zero-initialize the struct-return slot of an Objective-C message
send before making the call.  Fixes rdar://problem/7854674

llvm-svn: 126543
diff --git a/clang/test/CodeGenObjC/messages.m b/clang/test/CodeGenObjC/messages.m
index 5f77a8e..b36fe5b 100644
--- a/clang/test/CodeGenObjC/messages.m
+++ b/clang/test/CodeGenObjC/messages.m
@@ -1,9 +1,7 @@
-// RUN: %clang_cc1 -emit-llvm -o %t %s
-// RUN: grep "objc_msgSend" %t | count 6
-// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o %t %s
-// RUN: grep "objc_msg_lookup" %t | count 6
-// RUN: %clang_cc1 -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o %t %s
-// RUN: grep "objc_msg_lookup_sender" %t | count 6
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC
+// RUN: %clang_cc1 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s -check-prefix=CHECK-MAC-NF
+// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-GNU
+// RUN: %clang_cc1 -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-GNU-NF
 
 typedef struct {
   int x;
@@ -15,12 +13,35 @@
   int i;
   MyPoint pt = { 1, 2};
 
+  // CHECK-MAC: call {{.*}} @objc_msgSend(
+  // CHECK-MAC-NF: call {{.*}} @objc_msgSend(
+  // CHECK-GNU: call {{.*}} @objc_msg_lookup(
+  // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender(
   [a print0];
+
+  // CHECK-MAC: call {{.*}} @objc_msgSend to
+  // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
+  // CHECK-GNU: call {{.*}} @objc_msg_lookup to
+  // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
   [a print1: 10];
+
+  // CHECK-MAC: call {{.*}} @objc_msgSend to
+  // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
+  // CHECK-GNU: call {{.*}} @objc_msg_lookup to
+  // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
   [a print2: 10 and: "hello" and: 2.2];
+
+  // CHECK-MAC: call {{.*}} @objc_msgSend to
+  // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
+  // CHECK-GNU: call {{.*}} @objc_msg_lookup to
+  // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
   [a takeStruct: pt ];
   
   void *s = @selector(print0);
   for (i=0; i<2; ++i)
+    // CHECK-MAC: call {{.*}} @objc_msgSend to
+    // CHECK-MAC-NF: call {{.*}} @objc_msgSend to
+    // CHECK-GNU: call {{.*}} @objc_msg_lookup to
+    // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to
     [a performSelector:s];
 }