<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Missing Verifier check for debug info intrinsics that precede their SSA operands"
   href="https://llvm.org/bugs/show_bug.cgi?id=27273">27273</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missing Verifier check for debug info intrinsics that precede their SSA operands
          </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>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Core LLVM classes
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dexonsmith@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>aprantl@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>r265631, reverted in r265637, uncovered a bug in -reassociate that breaks the
order of @llvm.dbg.value instructions compared to the SSA values they
reference.

The current Verifier check doesn't look through the
MetadataAsValue/LocalAsMetadata operands that debug info intrinsics use, such
as `metadata i32 %x` in:
--
call void @llvm.dbg.value(metadata i32 %x, ...)
%x = add i32 0, %arg
--

As a result, we need a hack in llvm::MapMetadata to return `!{}` instead of
`null` when RF_IgnoreMissingLocals is turned off to prevent a crash in
llvm::RemapInstruction.

We should add a verifier check; fix the bugs; write an upgrade to drop invalid
instructions and commit the verifier check; and then fix llvm::MapMetadata to
ignore RF_IgnoreMissingLocals (as r265631 tried to do).

There's a more complete write-up of the issue on llvm-commits (in the reply to
r265631):

  <a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160404/345617.html">http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160404/345617.html</a>

For now I'm going to push forward with a modified version of r265631 that
documents what's going on.  I'll add a comment with the revision.</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>