[PATCH] D145168: Move DBG_VALUE's that depend on loads to after a load if the load is moved due to the pre register allocation ld/st optimization pass

Shubham Sandeep Rastogi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 09:04:17 PST 2023


rastogishubham created this revision.
rastogishubham added reviewers: aprantl, jmorse.
Herald added a subscriber: hiraditya.
Herald added a project: All.
rastogishubham requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The issue here is that there can be a scenario where debug information is lost because of the pre register allocation load store optimization pass, where a load who's result describes the debug infomation for a local variable gets moved below the load and that causes the debug information for that load to get lost.

  
  Example:
  
  Before the Pre Register Allocation Load Store Pass
  inst_a
  %2 = ld ...
  inst_b
  DBG_VALUE %2, "x", ...
  %3 = ld ...
  
  After the Pass:
  inst_a
  inst_b
  DBG_VALUE %2, "x", ...
  %2 = ld ...
  %3 = ld ...
  
  The load has now been moved to after the DBG_VAL that uses its result and the debug info for "x" has been lost. What we want is:
  
  inst_a
  inst_b
  %2 = ld ...
  DBG_VALUE %2, "x", ...
  %3 = ld ...
  
  Which is what this patch addresses


https://reviews.llvm.org/D145168

Files:
  llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
  llvm/test/DebugInfo/ARM/move-dbg-values.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145168.501887.patch
Type: text/x-patch
Size: 25014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230302/95b8daee/attachment.bin>


More information about the llvm-commits mailing list