summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-08-24 21:34:21 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-08-24 21:34:21 +0000
commit3cbfb65a529b2826a41f0d0418f540e6ffb3fc42 (patch)
tree1abcbfc5193c773b99add98b2ee225468694729a /clang/lib/CodeGen
parent342f60384e84c871b78cebffcac82ab0b6644c2e (diff)
downloadbcm5719-llvm-3cbfb65a529b2826a41f0d0418f540e6ffb3fc42.tar.gz
bcm5719-llvm-3cbfb65a529b2826a41f0d0418f540e6ffb3fc42.zip
[MS ABI] Don't emit stackrestore in cleanups
The stackrestore intrinsic isn't meaningful inside of a cleanup funclet. llvm-svn: 245879
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp16
-rw-r--r--clang/lib/CodeGen/CGCall.h1
2 files changed, 1 insertions, 16 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index f40dd086481..93984e619bd 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -2782,21 +2782,11 @@ 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(EHCleanup, StackBaseMem);
+ CGF.pushStackRestore(NormalCleanup, 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,
@@ -3533,10 +3523,6 @@ 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:
diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index 7a4708e5ccf..f898676676a 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -120,7 +120,6 @@ namespace CodeGen {
void allocateArgumentMemory(CodeGenFunction &CGF);
llvm::Instruction *getStackBase() const { return StackBase; }
- void freeArgumentMemory(CodeGenFunction &CGF) const;
/// \brief Returns if we're using an inalloca struct to pass arguments in
/// memory.
OpenPOWER on IntegriCloud