summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-08-25 18:43:32 +0000
committerNico Weber <nicolasweber@gmx.de>2015-08-25 18:43:32 +0000
commit8cdb3f90ef8be523758b8b9a1d4e1950b2fe5cd8 (patch)
tree9ef03c96e6c0666b1c80987f592c6d71d6050e17 /clang/lib/CodeGen/CGCall.cpp
parent85d65a185d91c223857ea4a226af13a6153abc82 (diff)
downloadbcm5719-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.cpp16
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:
OpenPOWER on IntegriCloud