<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 - [DAGCombiner] SDDbgValue is set as invalid by tryToFoldExtOfLoad()"
   href="https://bugs.llvm.org/show_bug.cgi?id=52373">52373</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[DAGCombiner] SDDbgValue is set as invalid by tryToFoldExtOfLoad()
          </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>Common Code Generator Code
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>paulsson@linux.vnet.ibm.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=25409" name="attach_25409" title="reduced testcase">attachment 25409</a> <a href="attachment.cgi?id=25409&action=edit" title="reduced testcase">[details]</a></span>
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)
---
<span class="quote">>   tail call void @_Z1fi(i32 signext %0)</span >

tryToFoldExtOfLoad() calls DAG.ReplaceAllUsesOfValueWith(), which calls
transferDbgValues(), but this is not working properly. When the original load
is deleted, the DbgValue is invalidated.</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>