[llvm-bugs] [Bug 48067] New: loop-reduce pass seems to drop debug location unnecessarily

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 3 20:23:38 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=48067

            Bug ID: 48067
           Summary: loop-reduce pass seems to drop debug location
                    unnecessarily
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: yuanboli233 at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24130
  --> https://bugs.llvm.org/attachment.cgi?id=24130&action=edit
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 (https://github.com/llvm/llvm-project.git
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
---
>   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
(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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201104/cb35846b/attachment.html>


More information about the llvm-bugs mailing list