-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Bugzilla Link | 37897 |
Version | trunk |
OS | All |
Reporter | LLVM Bugzilla Contributor |
CC | @francisvm,@jmorse,@pogo59 |
Extended Description
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;
bar()
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.