diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-10-26 18:32:16 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-10-26 18:32:16 +0000 |
commit | e78a62207a98666b1f522f2f584e918bd377b9f7 (patch) | |
tree | dca3858f5cc1ba25c2a30f7919757272c54da148 /clang/lib/CodeGen/CGBlocks.cpp | |
parent | ac50f3e9071eaeef20104ec4bb8a4ad588d55443 (diff) | |
download | bcm5719-llvm-e78a62207a98666b1f522f2f584e918bd377b9f7.tar.gz bcm5719-llvm-e78a62207a98666b1f522f2f584e918bd377b9f7.zip |
Revert "Simplify codegen and debug info generation for block context parameters."
This reverts commit r316684 while investigating buildbot breakage.
llvm-svn: 316686
Diffstat (limited to 'clang/lib/CodeGen/CGBlocks.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index e7743fa0c65..2915dabe541 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -1294,19 +1294,19 @@ void CodeGenFunction::setBlockContextParameter(const ImplicitParamDecl *D, assert(BlockInfo && "not emitting prologue of block invocation function?!"); llvm::Value *localAddr = nullptr; - // Allocate a stack slot like for any local variable to guarantee optimal - // debug info at -O0. The mem2reg pass will eliminate it when optimizing. - Address alloc = CreateMemTemp(D->getType(), D->getName() + ".addr"); - Builder.CreateStore(arg, alloc); - localAddr = Builder.CreateLoad(alloc); + if (CGM.getCodeGenOpts().OptimizationLevel == 0) { + // Allocate a stack slot to let the debug info survive the RA. + Address alloc = CreateMemTemp(D->getType(), D->getName() + ".addr"); + Builder.CreateStore(arg, alloc); + localAddr = Builder.CreateLoad(alloc); + } if (CGDebugInfo *DI = getDebugInfo()) { if (CGM.getCodeGenOpts().getDebugInfo() >= codegenoptions::LimitedDebugInfo) { DI->setLocation(D->getLocation()); - DI->EmitDeclareOfBlockLiteralArgVariable( - *BlockInfo, D->getName(), argNum, - cast<llvm::AllocaInst>(alloc.getPointer()), Builder); + DI->EmitDeclareOfBlockLiteralArgVariable(*BlockInfo, arg, argNum, + localAddr, Builder); } } |