[all-commits] [llvm/llvm-project] 0aaf63: Move DBG_VALUE's that depend on loads to after a

Shubham Sandeep Rastogi via All-commits all-commits at lists.llvm.org
Wed Apr 12 12:12:11 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0aaf634152f25a805563d552e72d89e8202d84f2
      https://github.com/llvm/llvm-project/commit/0aaf634152f25a805563d552e72d89e8202d84f2
  Author: Shubham Sandeep Rastogi <srastogi22 at apple.com>
  Date:   2023-04-12 (Wed, 12 Apr 2023)

  Changed paths:
    M llvm/include/llvm/IR/DebugInfoMetadata.h
    M llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
    A llvm/test/DebugInfo/ARM/move-dbg-value-after-value-list.mir
    A llvm/test/DebugInfo/ARM/move-dbg-value-lists.mir
    A llvm/test/DebugInfo/ARM/move-dbg-value-same-reg.mir
    A llvm/test/DebugInfo/ARM/move-dbg-values.mir

  Log Message:
  -----------
  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

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

Differential Revision: https://reviews.llvm.org/D145168




More information about the All-commits mailing list