[llvm-bugs] [Bug 52373] New: [DAGCombiner] SDDbgValue is set as invalid by tryToFoldExtOfLoad()

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 1 08:39:50 PDT 2021


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

            Bug ID: 52373
           Summary: [DAGCombiner] SDDbgValue is set as invalid by
                    tryToFoldExtOfLoad()
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: paulsson at linux.vnet.ibm.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 25409
  --> https://bugs.llvm.org/attachment.cgi?id=25409&action=edit
reduced testcase

This reduced function has an i32 argument passed to a called function:

define void @fun1(i1 %u) #0 !dbg !4 {
entry:
  %0 = load i32, i32* @t, align 4
  tail call void @llvm.dbg.value(metadata i32 %0, metadata !10, metadata
!DIExpression()), !dbg !17
  tail call void @_Z1fi(i32 %0)
  unreachable
}

llc -mtriple=s390x-linux-gnu -O0 tc_dbgval.ll -o - |& grep DEBUG
        #DEBUG_VALUE: s <- $r2l

If that argument is signextended, the debug value is invalidated ("removed"):

llc -mtriple=s390x-linux-gnu -O0 tc_dbgval_arg_signext.ll -o - |& grep DEBUG
        #DEBUG_VALUE: s <- undef

diff tc_dbgval.ll tc_dbgval_arg_signext.ll
13c13
<   tail call void @_Z1fi(i32 %0)
---
>   tail call void @_Z1fi(i32 signext %0)

tryToFoldExtOfLoad() calls DAG.ReplaceAllUsesOfValueWith(), which calls
transferDbgValues(), but this is not working properly. When the original load
is deleted, the DbgValue is invalidated.

-- 
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/20211101/a5de6e06/attachment.html>


More information about the llvm-bugs mailing list