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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits