[PATCH] D52614: [DebugInfo][Dexter] Divide-before-return displays wrong value in debugger

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 08:26:17 PDT 2018


aprantl added a comment.

Thanks, this looks mostly good!



================
Comment at: include/llvm/CodeGen/MachineInstr.h:1547
 
+  /// Update any matching DBG_VALUEs with the given register.
+  void updateDebugValues(unsigned Reg);
----------------
How about:

`/// Find all DBG_VALUEs immediately following this instruction that point to a register def in this instruction and point them to \p Reg instead.`

Looking at the implementation of collectDebugValues() I'm somewhat puzzled how it works. Perhaps I'm misunderstanding what it is supposed to do, please let me know. It's scanning for DBG_VALUEs that point to Op0 of the instruction. Is Op0 always going to be a def? Or should it be improved?


================
Comment at: include/llvm/CodeGen/MachineInstr.h:1548
+  /// Update any matching DBG_VALUEs with the given register.
+  void updateDebugValues(unsigned Reg);
+
----------------
Could you give this a more descriptive name?


================
Comment at: test/CodeGen/MIR/X86/pr38773.mir:153
+    ; CHECK-NEXT:   DBG_VALUE debug-use $eax, debug-use $noreg, !14, !DIExpression(), debug-location !23
+    ; CHECK-NEXT:   DBG_VALUE debug-use $eax, debug-use $noreg, !14, !DIExpression(), debug-location !23
+    DBG_VALUE debug-use $ecx, debug-use $noreg, !14, !DIExpression(), debug-location !23
----------------
This line is an exact duplicate of the previous line. While this won't break anything, it's inefficient.
Looking at the definition of collectDebugValues it doesn't look like this patch is responsible, but it would still be good to fix. Whoever is inserting these DBG_VALUEs in the first place should be doing a check for duplicates? Doing a linear search of any DBG_VALUEs immediately following the insertion point (like collectDebugValues does) should be sufficient.


Repository:
  rL LLVM

https://reviews.llvm.org/D52614





More information about the llvm-commits mailing list