diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-08-25 18:43:32 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-08-25 18:43:32 +0000 |
commit | 8cdb3f90ef8be523758b8b9a1d4e1950b2fe5cd8 (patch) | |
tree | 9ef03c96e6c0666b1c80987f592c6d71d6050e17 /clang/lib/CodeGen/CGCall.cpp | |
parent | 85d65a185d91c223857ea4a226af13a6153abc82 (diff) | |
download | bcm5719-llvm-8cdb3f90ef8be523758b8b9a1d4e1950b2fe5cd8.tar.gz bcm5719-llvm-8cdb3f90ef8be523758b8b9a1d4e1950b2fe5cd8.zip |
Revert r245879. Speculative, might have caused crbug.com/524604
llvm-svn: 245965
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 93984e619bd..f40dd086481 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -2782,11 +2782,21 @@ void CallArgList::allocateArgumentMemory(CodeGenFunction &CGF) { // alloca and store lazily on the first cleanup emission. StackBaseMem = CGF.CreateTempAlloca(CGF.Int8PtrTy, "inalloca.spmem"); CGF.Builder.CreateStore(StackBase, StackBaseMem); - CGF.pushStackRestore(NormalCleanup, StackBaseMem); + CGF.pushStackRestore(EHCleanup, StackBaseMem); StackCleanup = CGF.EHStack.getInnermostEHScope(); assert(StackCleanup.isValid()); } +void CallArgList::freeArgumentMemory(CodeGenFunction &CGF) const { + if (StackBase) { + CGF.DeactivateCleanupBlock(StackCleanup, StackBase); + llvm::Value *F = CGF.CGM.getIntrinsic(llvm::Intrinsic::stackrestore); + // We could load StackBase from StackBaseMem, but in the non-exceptional + // case we can skip it. + CGF.Builder.CreateCall(F, StackBase); + } +} + void CodeGenFunction::EmitNonNullArgCheck(RValue RV, QualType ArgType, SourceLocation ArgLoc, const FunctionDecl *FD, @@ -3523,6 +3533,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, if (CallArgs.hasWritebacks()) emitWritebacks(*this, CallArgs); + // The stack cleanup for inalloca arguments has to run out of the normal + // lexical order, so deactivate it and run it manually here. + CallArgs.freeArgumentMemory(*this); + RValue Ret = [&] { switch (RetAI.getKind()) { case ABIArgInfo::InAlloca: |