[cfe-commits] r156047 - in /cfe/trunk/test/CodeGenCXX: x86-64-abi-sret-vs-2word-struct-param.cpp x86_64-arguments.cpp

John McCall rjmccall at apple.com
Wed May 2 18:34:46 PDT 2012


Author: rjmccall
Date: Wed May  2 20:34:46 2012
New Revision: 156047

URL: http://llvm.org/viewvc/llvm-project?rev=156047&view=rev
Log:
Merge x86-64-abi-sret-vs-2word-struct-param.cpp into the generic
x86_64-arguments.cpp test file and be sure to test the coerced
case as well.  Thanks to Wei-Ren Chen for bringing this test
to my attention.

Removed:
    cfe/trunk/test/CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp
Modified:
    cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp

Removed: cfe/trunk/test/CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp?rev=156046&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp (removed)
@@ -1,29 +0,0 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
-// XTARGET: x86
-// PR4242
-// (PR 4242 bug is on 64-bit only, test passes on x86-32 as well)
-
-struct S {
-    void* data[3];
-};
-
-struct T {
-    void* data[2];
-};
-
-// CHECK: %struct.T* byval
-extern "C" S fail(int, int, int, int, T t, void* p) {
-    S s;
-    s.data[0] = t.data[0];
-    s.data[1] = t.data[1];
-    s.data[2] = p;
-    return s;
-}
-
-// CHECK: %struct.T* byval
-extern "C" S* succeed(S* sret, int, int, int, int, T t, void* p) {
-    sret->data[0] = t.data[0];
-    sret->data[1] = t.data[1];
-    sret->data[2] = p;
-    return sret;
-}

Modified: cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp?rev=156047&r1=156046&r2=156047&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/x86_64-arguments.cpp Wed May  2 20:34:46 2012
@@ -56,6 +56,7 @@
   
   // CHECK: define <2 x float> @_ZN6PR77423fooEPNS_2c2E(%"struct.PR7742::c2"* %P)
   c2 foo(c2 *P) {
+    return c2();
   }
   
 }
@@ -149,3 +150,34 @@
    foo(b);
   }
 }
+
+// PR4242
+namespace test9 {
+  // Large enough to be passed indirectly.
+  struct S { void *data[3]; };
+
+  struct T { void *data[2]; };
+
+  // CHECK: define void @_ZN5test93fooEPNS_1SEPNS_1TE([[S:%.*]]*, [[T:%.*]]*)
+  void foo(S*, T*) {}
+
+  // CHECK: define void @_ZN5test91aEiiiiNS_1TEPv([[S]]* noalias sret {{%.*}}, i32, i32, i32, i32, [[T]]* byval align 8, i8*)
+  S a(int, int, int, int, T, void*) {
+    return S();
+  }
+
+  // CHECK: define [[S]]* @_ZN5test91bEPNS_1SEiiiiNS_1TEPv([[S]]* {{%.*}}, i32, i32, i32, i32, [[T:%.*]]* byval align 8, i8*)
+  S* b(S* sret, int, int, int, int, T, void*) {
+    return sret;
+  }
+
+  // CHECK: define void @_ZN5test91cEiiiNS_1TEPv([[S]]* noalias sret {{%.*}}, i32, i32, i32, i8* {{%.*}}, i8* {{%.*}}, i8*)
+  S c(int, int, int, T, void*) {
+    return S();
+  }
+
+  // CHECK: define [[S]]* @_ZN5test91dEPNS_1SEiiiNS_1TEPv([[S]]* {{%.*}}, i32, i32, i32, i8* {{%.*}}, i8* {{%.*}}, i8*)
+  S* d(S* sret, int, int, int, T, void*) {
+    return sret;
+  }
+}





More information about the cfe-commits mailing list