<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 - SalvageDebugInfo crash when using -debug (in bitTrackingDCE)"
   href="https://bugs.llvm.org/show_bug.cgi?id=38924">38924</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SalvageDebugInfo crash when using -debug (in bitTrackingDCE)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.stenberg@ericsson.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=20873" name="attach_20873" title="IR reproducer.">attachment 20873</a> <a href="attachment.cgi?id=20873&action=edit" title="IR reproducer.">[details]</a></span>
IR reproducer.

Reproduced on trunk (rL342000).

When running the following opt command on the attached IR reproducer:

    opt -bdce -o /dev/null bdce.ll -debug

you get a crash due to using isa<> on a null pointer when printing the debug
value:

    Args: opt -bdce -o /dev/null bdce.ll -debug
        discovered a new reachable node %entry
        discovered a new reachable node %entry
        discovered a new reachable node %entry
    DemandedBits: Root:   call void @llvm.dbg.value(metadata i32 %or248,
metadata !6, metadata !DIExpression()), !dbg !8
    DemandedBits: Root:   ret void
    SALVAGE:   call void @llvm.dbg.value(metadata i32 123, metadata opt:
../include/llvm/Support/Casting.h:92: static bool
llvm::isa_impl_cl<llvm::Function, llvm::Value *>::doit(const From *) [To =
llvm::Function, From = llvm::Value *]: Assertion `Val && "isa<> used on a null
pointer"' failed.
    Stack dump:
    0.  Program arguments: opt -bdce -o /dev/null bdce.ll -debug
    1.  Running pass 'Function Pass Manager' on module 'bdce.ll'.
    2.  Running pass 'Bit-Tracking Dead Code Elimination' on function '@bar'</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>