[PATCH] D88978: [WIP] Attach debug intrinsics to allocas, and use correct address space

Scott Linder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 9 14:08:16 PDT 2020


scott.linder added inline comments.


================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1579
   if (EmitDebugInfo && HaveInsertPoint()) {
-    Address DebugAddr = address;
+    Address DebugAddr = AllocaAddr.isValid() ? AllocaAddr : address;
     bool UsePointerValue = NRVO && ReturnValuePointer.isValid();
----------------
aprantl wrote:
> This is unintuitive — can you add a comment explaining why it may not be valid and why address should only be used then?
This is kind of a cop-out on my part, the only path where this occurs is for OpenMP, and I think I just need to understand better what is happening. This also occurs for NRVO, but that is explicitly called out just below this. I'll try to understand this more completely and see if I can represent the possibilities more direclty.

Somewhat related, it is a bit unsettling reading through this, as the invariant seems to be that `address.isValid()` by the time the call to `setAddrOfLocalVar` is called, which makes sense but isn't explicit anywhere in the multiple nested `if`s. I'll also add an assert of that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88978/new/

https://reviews.llvm.org/D88978



More information about the cfe-commits mailing list