[PATCH] D58191: [DebugInfo] Make postra sinking of DBG_VALUEs safe in the presence of subregisters

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 09:20:58 PST 2019


jmorse created this revision.
jmorse added reviewers: aprantl, bjope, vsk.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.

Currently the machine instruction sinker identifies DBG_VALUE insts that also need to sink by comparing register numbers. Unfortunately this isn't safe, because (after register allocation) a DBG_VALUE may read a register that aliases what's being sunk. To fix this, identify the DBG_VALUEs that need to sink by recording & examining their register units. Register units gives us the following guarantee:

  "Two registers overlap if and only if they have a common register unit" [MCRegisterInfo.h]

Thus we can always identify aliasing DBG_VALUEs if the set of register units read by the DBG_VALUE, and the register units of the instruction being sunk, intersect. (MachineSink already uses classes like "LiveRegUnits" for determining sinking validity anyway).

The test added checks for super and subregister DBG_VALUE reads of a sunk copy being sunk as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D58191

Files:
  lib/CodeGen/MachineSink.cpp
  test/DebugInfo/MIR/X86/postra-subreg-sink.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58191.186683.patch
Type: text/x-patch
Size: 8027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190213/dd0568a5/attachment.bin>


More information about the llvm-commits mailing list