+++ /dev/null
-// 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;
-}
// CHECK: define <2 x float> @_ZN6PR77423fooEPNS_2c2E(%"struct.PR7742::c2"* %P)
c2 foo(c2 *P) {
+ return c2();
}
}
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;
+ }
+}