Original commit:
Lambda functions with inalloca parameters (which are used in 32-bit Windows) currently aren't supported because the call operator delegates to another function and forwards its arguments, and inalloca parameters can't be forwarded. (The same issue exists for variadic arguments.)
This patch emits the lambda call operator again with a different calling convention without inallocas. Then the original call operator and static invoker delegate to this new function. We also modify arrangeLLVMFunctionInfo to be able to generate a different CGFunctionInfo for delegate calls that doesn't use inalloca.
Fixes https://github.com/llvm/llvm-project/issues/28673.
Changes:
- Make sure we only emit the new callop function body if the static invoker is actually used
- Hopefully avoid making a copy of the forward types when calling the impl function.
This reverts commit 8ed7aa59f489715d39d32e72a787b8e75cfda151.
I think the problem is that it tries to do a copy here because the alignment of the forwarding function arg is larger than the alignment of the object that's being passed. I'm not sure how alignments are computed or if there are any other requirements for alignment. Is it ok to just ignore the new alignment? Do we need to change the code that computes the argument alignment?
(crbug.com/1457256#comment2 has an example repro)