[llvm-bugs] [Bug 48722] New: sccp pass drop debug location unnecessarily

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 11 11:36:59 PST 2021


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

            Bug ID: 48722
           Summary: sccp pass 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 24370
  --> https://bugs.llvm.org/attachment.cgi?id=24370&action=edit
abc_debug.ll

Overview: In the attached example, the sccp pass will drop debug location
unnecessarily.

Steps to reproduce:

Here is the version of llvm:
$ clang++ --version
clang version 12.0.0 (https://github.com/llvm/llvm-project.git
b8d28420885a42d16a57e02c28129d0eb92474a1)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ opt -sccp abc_debug.ll > result.bc
$ llvm-dis result.bc

$ diff abc_debug.ll result.ll 
...(irrelevant text)...
33,34c33,34
<   %tmp10 = sext i32 %tmp9 to i64, !dbg !30
<   call void @llvm.dbg.value(metadata i64 %tmp10, metadata !19, metadata
!DIExpression()), !dbg !30
---
>   %0 = zext i32 %tmp9 to i64
>   call void @llvm.dbg.value(metadata i64 %0, metadata !19, metadata !DIExpression()), !dbg !30

the variable %tmp10 seems to have a one-to-one relationship with %0, so it
seems that the debug location !30 is unnecessarily dropped, according to the
principles in:
    https://llvm.org/docs/HowToUpdateDebugInfo.html
There's a one-to-one relationship between the new and old instruction, and it's
placed in the same location, so the DebugLoc should be preserved in the
reproducer.

-- 
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/20210111/eb380e86/attachment.html>


More information about the llvm-bugs mailing list