1 // RUN: %clang_cc1 -triple i386-pc-win32 -emit-llvm %s -o - | FileCheck %s
5 // A trivial 20 byte struct is returned indirectly and taken as byval.
12 S
variadic_sret(const char *f
, ...);
13 S __cdecl
cdecl_sret();
14 S __cdecl
byval_and_sret(S a
);
18 S
C::variadic_sret(const char *f
, ...) { return S(); }
19 S
C::cdecl_sret() { return S(); }
20 S
C::byval_and_sret(S a
) { return S(); }
22 // CHECK: define dso_local void @"?variadic_sret@C@@QAA?AUS@@PBDZZ"(%struct.C* {{[^,]*}} %this, %struct.S* noalias sret(%struct.S) align 4 %agg.result, i8* noundef %f, ...)
23 // CHECK: define dso_local void @"?cdecl_sret@C@@QAA?AUS@@XZ"(%struct.C* {{[^,]*}} %this, %struct.S* noalias sret(%struct.S) align 4 %agg.result)
24 // CHECK: define dso_local void @"?byval_and_sret@C@@QAA?AUS@@U2@@Z"(%struct.C* {{[^,]*}} %this, %struct.S* noalias sret(%struct.S) align 4 %agg.result, %struct.S* noundef byval(%struct.S) align 4 %a)
28 c
.variadic_sret("asdf");
30 c
.byval_and_sret(S());
32 // CHECK-LABEL: define dso_local noundef i32 @main()
33 // CHECK: call void {{.*}} @"?variadic_sret@C@@QAA?AUS@@PBDZZ"
34 // CHECK: call void @"?cdecl_sret@C@@QAA?AUS@@XZ"
35 // CHECK: call void @"?byval_and_sret@C@@QAA?AUS@@U2@@Z"
37 // __fastcall has similar issues.
39 S __fastcall
f(int x
);
44 // CHECK-LABEL: define dso_local x86_fastcallcc void @"?f@A@@QAI?AUS@@H@Z"(%struct.A* inreg noundef nonnull align 1 dereferenceable(1) %this, %struct.S* inreg noalias sret(%struct.S) align 4 %agg.result, i32 noundef %x)