<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 - loop-reduce pass seems to drop debug location unnecessarily"
href="https://bugs.llvm.org/show_bug.cgi?id=48067">48067</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>loop-reduce pass seems to drop debug location unnecessarily
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>yuanboli233@gmail.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=24130" name="attach_24130" title="the IR file that triggers the potential bug">attachment 24130</a> <a href="attachment.cgi?id=24130&action=edit" title="the IR file that triggers the potential bug">[details]</a></span>
the IR file that triggers the potential bug
Overview: In some cases, it seems that the loop-reduce pass will drop debug
location unnecessarily.
Steps to reproduce:
Here is my version of llvm:
$ clang++ --version
clang version 12.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a>
f847094c246810d698d3d6d476f066e9b8779456)
Target: x86_64-unknown-linux-gnu
The IR file abc.ll is uploaded in the attachment. It is a file obtained from
LLVM regression tests
(llvm/test/Transforms/LoopStrengthReduce/X86/2008-08-14-ShadowIV.ll). We run
debugify pass to generate artificial debugging information for the IR file to
get the current version of abc.ll.
$ /home/absozero/trunk/root-clang/bin/opt -loop-reduce abc.ll > result.bc
$ /home/absozero/trunk/root-clang/bin/llvm-dis result.bc
Then we can get result.ll as the output of the loop-reduce pass.
$ diff abc.ll result.ll | head -n 30
(omit some irrelevant text)......
26,28c25,27
< %exitcond = icmp eq i32 %indvar.next, %umax, !dbg !27
< call void @llvm.dbg.value(metadata i1 %exitcond, metadata !17, metadata
!DIExpression()), !dbg !27
< br i1 %exitcond, label %return, label %bb, !dbg !28
---
<span class="quote">> call void @llvm.dbg.value(metadata i1 %scmp, metadata !17, metadata !DIExpression()), !dbg !27
> %scmp = icmp uge i32 %indvar.next, %n
> br i1 %scmp, label %return.loopexit, label %bb, !dbg !28</span >
(omit some irrelevant text)......
After the loop-reduce, the variable %exitcond is replaced by another variable
%scmp. However, the variable %scmp seems to drop the debug location !dbg !27
unnecessarily.</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>