<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 - Too narrow debug location range after register coalescing"
href="https://bugs.llvm.org/show_bug.cgi?id=44651">44651</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Too narrow debug location range after register coalescing
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</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>DebugInfo
</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>jdevlieghere@apple.com, keith.walker@arm.com, llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
</td>
</tr></table>
<p>
<div>
<pre>Commit: 4e8116f4692e9b5787ba91c6b557b113aae7e244
Reproducer:
extern void foo(int *);
extern void bar(int *);
int global;
int main() {
int *ptr = &global;
foo(ptr);
bar(ptr);
return 0;
}
Command:
clang -O1 -g global-ptr.c
The location list for the local `ptr' variable only covers the call to bar(),
and not the one to foo():
main: # @main
.Lfunc_begin0:
.loc 1 6 0 # global-ptr.c:6:0
.cfi_startproc
# %bb.0: # %entry
pushq %rax
.cfi_def_cfa_offset 16
.Ltmp0:
.loc 1 8 3 prologue_end # global-ptr.c:8:3
movl $global, %edi
callq foo
.Ltmp1:
.loc 1 9 3 # global-ptr.c:9:3
movl $global, %edi
.Ltmp2:
#DEBUG_VALUE: main:ptr <- $rdi
callq bar
.Ltmp3:
.loc 1 10 3 # global-ptr.c:10:3
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
This seems to be due to something Simple Register Coalescing does:
-# *** IR Dump Before Simple Register Coalescing ***:
+# *** IR Dump After Simple Register Coalescing ***:
# Machine code for function main: NoPHIs, TracksLiveness
0B bb.0.entry:
16B ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp,
implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit
$ssp, debug-location !23; global-ptr.c:8:3
-32B %0:gr64 = MOV32ri64 @global, debug-location !23;
global-ptr.c:8:3
- DBG_VALUE %0:gr64, $noreg, !"ptr", !DIExpression(), debug-location
!22; global-ptr.c:0 line no:7
-48B $rdi = COPY %0:gr64, debug-location !23; global-ptr.c:8:3
+48B $rdi = MOV32ri64 @global, debug-location !23;
global-ptr.c:8:3
64B CALL64pcrel32 @foo, <regmask $bh $bl $bp $bph $bpl $bx $ebp
$ebx $hbp $hbx $rbp $rbx $r12 $r13 $r14 $r15 $r12b $r13b $r14b $r15b $r12bh
$r13bh $r14bh $r15bh $r12d $r13d $r14d $r15d $r12w $r13w $r14w $r15w $r12wh and
3 more...>, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit-def
$rsp, implicit-def $ssp, debug-location !23; global-ptr.c:8:3
80B ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def
dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp,
debug-location !23; global-ptr.c:8:3
96B ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp,
implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit
$ssp, debug-location !24; global-ptr.c:9:3
-112B $rdi = COPY %0:gr64, debug-location !24; global-ptr.c:9:3
+112B $rdi = MOV32ri64 @global, debug-location !24;
global-ptr.c:9:3
+ DBG_VALUE $rdi, $noreg, !"ptr", !DIExpression(), debug-location !22;
global-ptr.c:0 line no:7
128B CALL64pcrel32 @bar, <regmask $bh $bl $bp $bph $bpl $bx $ebp
$ebx $hbp $hbx $rbp $rbx $r12 $r13 $r14 $r15 $r12b $r13b $r14b $r15b $r12bh
$r13bh $r14bh $r15bh $r12d $r13d $r14d $r15d $r12w $r13w $r14w $r15w $r12wh and
3 more...>, implicit $rsp, implicit $ssp, implicit killed $rdi, implicit-def
$rsp, implicit-def $ssp, debug-location !24; global-ptr.c:9:3
144B ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def
dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp,
debug-location !24; global-ptr.c:9:3
-160B %1:gr32 = MOV32r0 implicit-def dead $eflags
-176B $eax = COPY %1:gr32, debug-location !25; global-ptr.c:10:3
+176B $eax = MOV32r0 implicit-def dead $eflags, debug-location !25;
global-ptr.c:10:3
192B RET 0, killed $eax, debug-location !25; global-ptr.c:10:3</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>