diff options
| author | NAKAMURA Takumi <geek4civic@gmail.com> | 2015-05-15 03:49:05 +0000 |
|---|---|---|
| committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2015-05-15 03:49:05 +0000 |
| commit | 1a6756bba07ef881d72d94e7b9646fedad71a16d (patch) | |
| tree | 6b197b2ffa94fc2f1c6411da919a35cc0acd1b93 /clang/lib/CodeGen | |
| parent | 95a2a7e612e693edb14ec113106347a6b8d8fd05 (diff) | |
| download | bcm5719-llvm-1a6756bba07ef881d72d94e7b9646fedad71a16d.tar.gz bcm5719-llvm-1a6756bba07ef881d72d94e7b9646fedad71a16d.zip | |
Revert r237385, "[CodeGen] Reuse stack space from unused function results"
It broke clang stage2, at least tblgen.
llvm-svn: 237418
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 26d9e1896d4..2922a215ade 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -3077,18 +3077,10 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, // If the call returns a temporary with struct return, create a temporary // alloca to hold the result, unless one is given to us. llvm::Value *SRetPtr = nullptr; - size_t UnusedReturnSize = 0; if (RetAI.isIndirect() || RetAI.isInAlloca()) { SRetPtr = ReturnValue.getValue(); - if (!SRetPtr) { + if (!SRetPtr) SRetPtr = CreateMemTemp(RetTy); - if (HaveInsertPoint()) { - uint64_t size = - CGM.getDataLayout().getTypeAllocSize(ConvertTypeForMem(RetTy)); - if (EmitLifetimeStart(size, SRetPtr)) - UnusedReturnSize = size; - } - } if (IRFunctionArgs.hasSRetArg()) { IRCallArgs[IRFunctionArgs.getSRetArgNo()] = SRetPtr; } else { @@ -3420,10 +3412,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, // insertion point; this allows the rest of IRgen to discard // unreachable code. if (CS.doesNotReturn()) { - if (UnusedReturnSize) - EmitLifetimeEnd(llvm::ConstantInt::get(Int64Ty, UnusedReturnSize), - SRetPtr); - Builder.CreateUnreachable(); Builder.ClearInsertionPoint(); @@ -3452,13 +3440,8 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, RValue Ret = [&] { switch (RetAI.getKind()) { case ABIArgInfo::InAlloca: - case ABIArgInfo::Indirect: { - RValue ret = convertTempToRValue(SRetPtr, RetTy, SourceLocation()); - if (UnusedReturnSize) - EmitLifetimeEnd(llvm::ConstantInt::get(Int64Ty, UnusedReturnSize), - SRetPtr); - return ret; - } + case ABIArgInfo::Indirect: + return convertTempToRValue(SRetPtr, RetTy, SourceLocation()); case ABIArgInfo::Ignore: // If we are ignoring an argument that had a result, make sure to |

