<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 - -callsite-splitting gives different result if dbg.value is present"
href="https://bugs.llvm.org/show_bug.cgi?id=35616">35616</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>-callsite-splitting gives different result if dbg.value is present
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</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>mikael.holmen@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=19533" name="attach_19533" title="reproducer">attachment 19533</a> <a href="attachment.cgi?id=19533&action=edit" title="reproducer">[details]</a></span>
reproducer
Doing
opt -S -o - foo2.ll -callsite-splitting
and
opt -S -o - foo2.ll -strip-debug -callsite-splitting
on
define internal i16 @bar(i16 %p1, i16 %p2) {
%_tmp3 = mul i16 %p2, %p1
ret i16 %_tmp3
}
define i16 @foo(i16 %in) {
br label %bb1
bb1:
%_tmp0 = icmp ne i16 %in, 0
br i1 %_tmp0, label %bb2, label %bb3
bb2:
br label %bb3
bb3:
%_tmp1 = phi i16 [ 0, %bb1 ], [ 1, %bb2 ]
%c = phi i16 [ 2, %bb1 ], [ 3, %bb2 ]
call void @llvm.dbg.value(metadata i16 %c, metadata !7, metadata
!DIExpression()), !dbg !8
%_tmp2 = call i16 @bar(i16 %_tmp1, i16 5)
ret i16 %_tmp2
}
; Function Attrs: nounwind readnone speculatable
declare void @llvm.dbg.value(metadata, metadata, metadata) #0
attributes #0 = { nounwind readnone speculatable }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2, !3}
!llvm.ident = !{!4}
!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "My
Compiler")
!1 = !DIFile(filename: "foo.c", directory: "/bar")
!2 = !{i32 2, !"Dwarf Version", i32 4}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = !{!"My Compiler"}
!5 = !DIBasicType(name: "int", size: 16, encoding: DW_ATE_signed)
!6 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, unit:
!0)
!7 = !DILocalVariable(name: "c", scope: !6, line: 5, type: !5)
!8 = !DILocation(line: 5, column: 7, scope: !6)
gives different results. With the llvm.dbg.value present the optimization
doesn't trigger, but if we remove it it does.
CallSiteSplitting.cpp does a couple of calls to getFirstNonPHI(). I suppose
using getFirstNonPHIOrDbg() could help ignoring the llvm.dbg.value but I have
no idea if more changes are needed.</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>