diff options
| author | Reid Kleckner <rnk@google.com> | 2017-01-13 17:18:19 +0000 |
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2017-01-13 17:18:19 +0000 |
| commit | 791bbf6f18bff3d02964b1db0ac1028917cf2082 (patch) | |
| tree | 21f6723d0d7bdb5a70313d2f44e60c4be8591b39 /clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp | |
| parent | 17d266bc96198c3d0bb3f27af23c35f2d893c6aa (diff) | |
| download | bcm5719-llvm-791bbf6f18bff3d02964b1db0ac1028917cf2082.tar.gz bcm5719-llvm-791bbf6f18bff3d02964b1db0ac1028917cf2082.zip | |
Use less byval on 32-bit Windows x86 for classes with bases
This comes up in V8, which has a Handle template class that wraps a
typed pointer, and is frequently passed by value. The pointer is stored
in the base, HandleBase. This change allows us to pass the struct as a
pointer instead of using byval. This avoids creating tons of temporary
allocas that we copy from during call lowering.
Eventually, it would be good to use FCAs here instead.
llvm-svn: 291917
Diffstat (limited to 'clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp')
| -rw-r--r-- | clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp b/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp index 7eea41c8712..eaae3493ccd 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-sret-and-byval.cpp @@ -64,6 +64,10 @@ struct BigWithDtor { int a, b, c, d, e, f; }; +struct BaseNoByval : Small { + int bb; +}; + // WIN32: declare void @"{{.*take_bools_and_chars.*}}" // WIN32: (<{ i8, [3 x i8], i8, [3 x i8], %struct.SmallWithDtor, // WIN32: i8, [3 x i8], i8, [3 x i8], i32, i8, [3 x i8] }>* inalloca) @@ -127,6 +131,12 @@ void medium_arg(Medium s) {} // WIN64: define void @"\01?medium_arg@@YAXUMedium@@@Z"(i64 %s.coerce) // WOA: define arm_aapcs_vfpcc void @"\01?medium_arg@@YAXUMedium@@@Z"([2 x i32] %s.coerce) +void base_no_byval_arg(BaseNoByval s) {} +// LINUX-LABEL: define void @_Z17base_no_byval_arg11BaseNoByval(%struct.BaseNoByval* byval align 4 %s) +// WIN32: define void @"\01?base_no_byval_arg@@YAXUBaseNoByval@@@Z"(i32 %s.0, i32 %s.1) +// WIN64: define void @"\01?base_no_byval_arg@@YAXUBaseNoByval@@@Z"(i64 %s.coerce) +// WOA: define arm_aapcs_vfpcc void @"\01?base_no_byval_arg@@YAXUBaseNoByval@@@Z"([2 x i32] %s.coerce) + void small_arg_with_ctor(SmallWithCtor s) {} // LINUX-LABEL: define void @_Z19small_arg_with_ctor13SmallWithCtor(%struct.SmallWithCtor* byval align 4 %s) // WIN32: define void @"\01?small_arg_with_ctor@@YAXUSmallWithCtor@@@Z"(i32 %s.0) |

