[PATCH] D85771: [DebugInstrRef][8/9] Convert DBG_INSTR_REFs into variable locations

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 12:48:52 PDT 2020


jmorse created this revision.
jmorse added a reviewer: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
jmorse requested review of this revision.

Handle DBG_INSTR_REF instructions in LiveDebugValues, to determine and propagate variable locations. The logic is fairly straight forwards:

- Collect a map of debug-instruction-number to the machine value numbers generated in the first walk through the function,
- When building the variable value transfer function and we see a DBG_INSTR_REF, look up the instruction it refers to, and pick the machine value number it generates,
- That's it; the rest of LiveDebugValues continues as normal.

Reviewing this change may be sticky, as it depends on what route we take with reviewing D83047 <https://reviews.llvm.org/D83047>.

Awkwardly, there are two kinds of instruction numbering happening here: the offset into the block (which is how machine value numbers are determined), and the numbers that we label instructions with when generating DBG_INSTR_REFs. Suggestions on naming them most welcome, I haven't come up with anything good yet.

Practically, the map above isn't to a set of value numbers, it's to a MachineInstr and its offset into its block. One can determine the machine value number it generates at a particular operand using that information.

I've also restructured the TransferTracker redefVar code a little, to separate some DBG_VALUE specific operations into its own method. The changes around redefVar should be largely NFC, while allowing DBG_INSTR_REFs to specify a value number rather than just a location.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85771

Files:
  llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
  llvm/test/DebugInfo/MIR/InstrRef/livedebugvalues_instrref_tolocs.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85771.284859.patch
Type: text/x-patch
Size: 15534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200811/72214168/attachment-0001.bin>


More information about the llvm-commits mailing list