[PATCH] D136998: Try to implement lambdas with inalloca parameters by inlining the call operator function.

Amy Huang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 2 15:30:13 PDT 2022


akhuang added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:3590-3593
+          getTarget().getCXXABI().isMicrosoft() &&
+          llvm::any_of(cast<CXXMethodDecl>(FD)->parameters(), [&](ParmVarDecl *P) {
+            return isInAllocaArgument(getCXXABI(), P->getType());
+            })) {
----------------
rnk wrote:
> For simplicity, what if we always emitted the call operator for all lambda static invokers into the IR first? So, this logic would then become almost exactly the same as the emitCXXStructor logic above.
> 
> Later, in EmitLambdaStaticInvokeBody, we can detect the inalloca case and start the cloning.
> For simplicity, what if we always emitted the call operator for all lambda static invokers into the IR first? So, this logic would then become almost exactly the same as the emitCXXStructor logic above.

Do you know where this should happen? I couldn't really figure out a place other than here for emitting the call operator. 

If I do the cloning inside the normal EmitLambdaStaticInvokeBody path it's a bit annoying because StartFunction/EndFunction get called before/after cloning.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136998/new/

https://reviews.llvm.org/D136998



More information about the cfe-commits mailing list