[PATCH] D84891: WIP: [Verifier] Flag dbg.declares which specify different addresses for the same fragment

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 02:42:19 PDT 2020


Orlando added a comment.

Hi @vsk, just a inline question from me. And in addition, I noticed that SourceLevelDebugging specifically states "there can only be one call to llvm.dbg.declare for a given concrete local variable". I wonder if we should update this to say something like "there can only be one call to llvm.dbg.declare for a given fragment of a local variable"?

Please let me know if these comments should wait til the patch is no longer WIP instead.



================
Comment at: llvm/lib/IR/Verifier.cpp:270
+  /// two different stack slots.
+  DenseMap<std::pair<DILocalVariable *, DIExpression *>, DbgDeclareInst *>
+      LocalFragment2Address;
----------------
Could we ever see two dbg.declares for the same variable fragment with different expressions?

```
dbg.declare(%x, metadata !1, metadata !DIExpression())
dbg.declare(%x, metadata !1, metadata !DIExpression(DW_OP_plus, DW_OP_constu, 1))
```

This is contrived and I don't have a reproducer, so I'm not sure if it is something worth considering. I was just reminded of [[https://bugs.llvm.org/show_bug.cgi?id=41992| PR41992]] and [[https://bugs.llvm.org/show_bug.cgi?id=43957|PR43957]] when I saw `std::pair<DILocalVariable *, DIExpression *>` being used to identify fragments of a variable.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84891



More information about the llvm-commits mailing list