<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - [DebugInfo] DBG_VALUE for spill is emitted before the spill is performed"
href="https://bugs.llvm.org/show_bug.cgi?id=38899">38899</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[DebugInfo] DBG_VALUE for spill is emitted before the spill is performed
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.stenberg@ericsson.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=20865" name="attach_20865" title="C reproducer.">attachment 20865</a> <a href="attachment.cgi?id=20865&action=edit" title="C reproducer.">[details]</a></span>
C reproducer.
Reproduced on trunk (r341822).
When compiling the attached C file using:
clang -O3 -g foo.c -S --target=ppc64 -S -emit-llvm -o foo.ll
llc -O3 foo.ll -o foo.mir -print-before-all -print-after-all -debug
-stop-after=virtregrewriter &> foo.log
we get a spurious DBG_VALUE emitted for the variable c after register
allocation.
Before Debug Variable Analysis:
# *** IR Dump Before Debug Variable Analysis ***:
# Machine code for function test: NoPHIs, TracksLiveness
Function Live Ins: $x3 in %0, $x4 in %1
0B bb.0.entry:
liveins: $x3, $x4
DBG_VALUE debug-use $x3, debug-use $noreg, !"a",
!DIExpression(), debug-location !16; foo.c:8:14 line no:8
DBG_VALUE debug-use $x4, debug-use $noreg, !"b",
!DIExpression(), debug-location !17; foo.c:8:21 line no:8
16B %1:g8rc = COPY $x4
DBG_VALUE debug-use %1:g8rc, debug-use $noreg, !"b",
!DIExpression(), debug-location !17; foo.c:8:21 line no:8
32B %0:g8rc = COPY $x3
DBG_VALUE debug-use %0:g8rc, debug-use $noreg, !"a",
!DIExpression(), debug-location !16; foo.c:8:14 line no:8
DBG_VALUE debug-use %0.sub_32:g8rc, debug-use $noreg, !"a",
!DIExpression(), debug-location !16; foo.c:8:14 line no:8
DBG_VALUE debug-use %1.sub_32:g8rc, debug-use $noreg, !"b",
!DIExpression(), debug-location !17; foo.c:8:21 line no:8
80B %4:gprc = MULLW %1.sub_32:g8rc, %0.sub_32:g8rc,
debug-location !18; foo.c:9:13
DBG_VALUE debug-use %4:gprc, debug-use $noreg, !"c",
!DIExpression(), debug-location !19; foo.c:9:7 line no:9
96B INLINEASM &"" [sideeffect] [attdialect], $0:[clobber], {{{
implicit-def early-clobber of $r0-$r1 omitted }}}, !25, debug-location !20;
foo.c:2:3 @[ foo.c:10:3 ]
112B %5:g8rc = EXTSW_32_64 %4:gprc, debug-location !26; foo.c:11:3
128B $x3 = COPY %5:g8rc, debug-location !26; foo.c:11:3
144B BLR8 implicit $lr8, implicit $rm, implicit $x3,
debug-location !26; foo.c:11:3
# End machine code for function test.
********** COMPUTING LIVE DEBUG VARIABLES: test **********
********** DEBUG VARIABLES **********
!"a,8" [0B;0e):0 [80B;80r):2 Loc0=debug-use $x3 Loc1=debug-use %0
Loc2=debug-use %0.sub_32
!"b,8" [0B;0e):0 [16r;32r):1 [80B;80r):2 Loc0=debug-use $x4
Loc1=debug-use %1 Loc2=debug-use %1.sub_32
!"c,9" [80r;112r):0 Loc0=debug-use %4
and after Virtual Register Rewriter:
********** EMITTING LIVE DEBUG VARIABLES **********
!"a,8" [0B;0e):0 [80B;80r):2 Loc0=debug-use $x3 Loc1=debug-use %0
Loc2=debug-use %0.sub_32
[0B;0e):0 %bb.0-160B
[64B;80r):1 %bb.0-160B
!"b,8" [0B;0e):0 [16r;32r):1 [80B;80r):2 Loc0=debug-use $x4
Loc1=debug-use %1 Loc2=debug-use %1.sub_32
[0B;0e):0 %bb.0-160B
[16r;32r):0 %bb.0-160B
[64B;80r):1 %bb.0-160B
!"c,9" [80r;112r):0 Loc0=debug-use %4
[80r;112r):0 %bb.0-160B
# *** IR Dump After Virtual Register Rewriter ***:
# Machine code for function test: NoPHIs, TracksLiveness, NoVRegs
Frame Objects:
fi#0: size=4, align=4, at location [SP]
Function Live Ins: $x3, $x4
bb.0.entry:
liveins: $x3, $x4
DBG_VALUE debug-use $x3, debug-use $noreg, !"a", !DIExpression(),
debug-location !16; foo.c:8:14 line no:8
DBG_VALUE debug-use $r3, debug-use $noreg, !"a", !DIExpression(),
debug-location !16; foo.c:8:14 line no:8
DBG_VALUE debug-use $x4, debug-use $noreg, !"b", !DIExpression(),
debug-location !17; foo.c:8:21 line no:8
DBG_VALUE debug-use $x4, debug-use $noreg, !"b", !DIExpression(),
debug-location !17; foo.c:8:21 line no:8
DBG_VALUE debug-use $r4, debug-use $noreg, !"b", !DIExpression(),
debug-location !17; foo.c:8:21 line no:8
renamable $r3 = MULLW renamable $r4, renamable $r3, implicit killed
$x3, implicit killed $x4, debug-location !18; foo.c:9:13
DBG_VALUE %stack.0, 0, !"c", !DIExpression(), debug-location !19;
foo.c:9:7 line no:9
STW killed renamable $r3, 0, %stack.0 :: (store 4 into %stack.0)
INLINEASM &"" [sideeffect] [attdialect], $0:[clobber], {{{
implicit-def early-clobber of $r0-$r1 omitted }}}, !25, debug-location !20;
foo.c:2:3 @[ foo.c:10:3 ]
renamable $r3 = LWZ 0, %stack.0, debug-location !26 :: (load 4 from
%stack.0); foo.c:11:3
renamable $x3 = EXTSW_32_64 killed renamable $r3, debug-location !26;
foo.c:11:3
BLR8 implicit $lr8, implicit $rm, implicit $x3, debug-location !26;
foo.c:11:3
As seen, a DBG_VALUE referring to the spill stack slot is emitted before the
spill is performed.
I guess that the ideal output would be a DBG_VALUE referring to $r3 after the
MULLW, and one after the spill, i.e.:
renamable $r3 = MULLW renamable $r4, renamable $r3, implicit killed
$x3, implicit killed $x4, debug-location !18; foo.c:9:13
DBG_VALUE debug-use $r3, debug-use $noreg, !"c", !DIExpression(),
debug-location !19; foo.c:9:7 line no:9
STW killed renamable $r3, 0, %stack.0 :: (store 4 into %stack.0)
DBG_VALUE %stack.0, 0, !"c", !DIExpression(), debug-location !19;
foo.c:9:7 line no:9</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>