[PATCH] D63361: Pretend NRVO variables are references so they can be found by debug info
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 10:17:29 PDT 2019
rnk added a comment.
This needs two unit tests:
- A clang test at `clang/test/CodeGenCXX/debug-info-nrvo.cpp` similar to other debug-info-* tests there. This test should have a second RUN line and extra checks for -fno-elide-constructors.
- An LLVM test at `llvm/test/DebugInfo/COFF/nrvo.ll` to show that we handle dbg.declare + deref
Truly, we should also test the inalloca case.
================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:3946
+ // the address of the variable.
+ if (VD->isNRVOVariable())
+ Expr.push_back(llvm::dwarf::DW_OP_deref);
----------------
I think we should check for `getLangOpts().ElideConstructors` here, and check that the debug info is correct (no deref) in that mode.
================
Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:908
--EI;
llvm::Value *Addr = Builder.CreateStructGEP(nullptr, &*EI, Idx);
Addr = Builder.CreateAlignedLoad(Addr, getPointerAlign(), "agg.result");
----------------
What I had in mind was to use this GEP as the ReturnValuePointer here. The inalloca parameter is also a pointer to stack memory, and a GEP is an offset, so it should end up being handled like a static alloca.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63361/new/
https://reviews.llvm.org/D63361
More information about the llvm-commits
mailing list