[llvm-bugs] [Bug 37897] New: [PostRA Machine Sink] Ensure dbg value consistency when moving dbg instructions across other dbg instructions.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 21 11:23:32 PDT 2018


            Bug ID: 37897
           Summary: [PostRA Machine Sink] Ensure dbg value consistency
                    when moving dbg instructions across other dbg
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: matthew.davis at sony.com
                CC: llvm-bugs at lists.llvm.org

A discussion in https://reviews.llvm.org/D45637 mentions a possible
inconsistent debug representation when sinking debug-info instructions across
other debug-info instructions associated to the same user variable.  I'll try
to distill the issue below, but the review provides a more detailed discussion.

While we have not yet seen such a case occur from user source code, it seems
that such a case might occur.  To better illustrate this idea, the following
example was ripped from the link referenced above:
    renamable $eax = COPY $edi
    DBG_VALUE debug-use $eax, debug-use $noreg, !14, !DIExpression(),
debug-location !16
    $esi = ADD $edi, 7
    DBG_VALUE debug-use $esi, debug-use $noreg, !14, !DIExpression(),
debug-location !17

In this hypothetical example, both DBG_VALUEs are associated with some user
variable !14.  If the MachineSink code were to sink the COPY and its associated
DBG_VALUE to some successor block, not displayed in the example above, then
there is the potential that a debugger will show incorrect data (old/original
debug data) when stepping pass the sunken instruction.

Another similar example, also ripped from the review is the following:
    if (p == NULL)
      b = 1;
    p = q;
Represented as IR:
    call dbg.value(!DIVariable("p", ...), null, !DIExpression(DW_OP_constu 0))
    %b = predicated_move(%p, i32 1) // assuming such an instruction exists :-)
    %p.1 = %q
    call dbg.value(!DIVariable("p", ...), %p.1,  !DIExpression()

In this example, moving the original dbg_value after the second would have the
effect of making variable 'p' appear NULL when stepping/inspecting instructions
after the second dbg.intrinsic.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180621/897d8336/attachment.html>

More information about the llvm-bugs mailing list