[PATCH] D87233: [POC][DebugInfo] Use entry values within IR

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 15:07:13 PDT 2020


dstenb added a comment.

Sorry for a piecemeal review from my part!



================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1612
+  for (auto &I : EntryBB) {
+    LLVM_DEBUG(llvm::dbgs() << "  Investigating: "; I.dump(););
+    if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(&I)) {
----------------
Perhaps this is too verbose?


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1613
+    LLVM_DEBUG(llvm::dbgs() << "  Investigating: "; I.dump(););
+    if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(&I)) {
+      if (DVI->getVariable() != Var)
----------------
Maybe make this an early continue?

```
DbgValueInst *DVI = dyn_cast<DbgValueInst>(&I);
if (!DVI)
  continue;



================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1622-1623
+      // Do not consider variables from inlined functions.
+      if (DVI->getDebugLoc()->getInlinedAt())
+        return nullptr;
+
----------------
I might be misunderstanding something here, but shouldn't we want to still search for the debug value even though we have encountered an inline variant of the same variable? I guess this is something that is not really common but still.

If so, this needs to be moved above the `getNumElements()` check.


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

https://reviews.llvm.org/D87233



More information about the llvm-commits mailing list