From 8ed7aa59f489715d39d32e72a787b8e75cfda151 Mon Sep 17 00:00:00 2001 From: Amy Huang Date: Thu, 22 Jun 2023 11:36:30 -0700 Subject: Revert "Try to implement lambdas with inalloca parameters by forwarding without use of inallocas." Causes a clang crash (see crbug.com/1457256). This reverts commit 015049338d7e8e0e81f2ad2f94e5a43e2e3f5220. --- clang/lib/CodeGen/CodeGenFunction.cpp | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 6899388..b8d3937 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -683,19 +683,6 @@ static bool matchesStlAllocatorFn(const Decl *D, const ASTContext &Ctx) { return true; } -bool CodeGenFunction::isInAllocaArgument(CGCXXABI &ABI, QualType Ty) { - const CXXRecordDecl *RD = Ty->getAsCXXRecordDecl(); - return RD && ABI.getRecordArgABI(RD) == CGCXXABI::RAA_DirectInMemory; -} - -bool CodeGenFunction::hasInAllocaArg(const CXXMethodDecl *MD) { - return getTarget().getTriple().getArch() == llvm::Triple::x86 && - getTarget().getCXXABI().isMicrosoft() && - llvm::any_of(MD->parameters(), [&](ParmVarDecl *P) { - return isInAllocaArgument(CGM.getCXXABI(), P->getType()); - }); -} - /// Return the UBSan prologue signature for \p FD if one is available. static llvm::Constant *getPrologueSignature(CodeGenModule &CGM, const FunctionDecl *FD) { @@ -1460,17 +1447,6 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, // The lambda static invoker function is special, because it forwards or // clones the body of the function call operator (but is actually static). EmitLambdaStaticInvokeBody(cast(FD)); - - } else if (isa(FD) && - isLambdaCallOperator(cast(FD)) && - cast(FD)->getParent()->getLambdaStaticInvoker() && - hasInAllocaArg(cast(FD) - ->getParent() - ->getLambdaStaticInvoker()) && - !FnInfo.isDelegateCall()) { - // If emitting a lambda with static invoker on X86 Windows, change - // the call operator body. - EmitLambdaInAllocaCallOpBody(cast(FD)); } else if (FD->isDefaulted() && isa(FD) && (cast(FD)->isCopyAssignmentOperator() || cast(FD)->isMoveAssignmentOperator())) { -- cgit v1.1