<html>
    <head>
      <base href="http://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 --- - Inlining corrupts debug locations if call-site's debug location is unknown"
   href="http://llvm.org/bugs/show_bug.cgi?id=20907">20907</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Inlining corrupts debug locations if call-site's debug location is unknown
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </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>DebugInfo
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>michaelwoerister@posteo.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In the Rust compiler we have consistently run into an assertion in
LexicalScopes::getOrCreateRegularScope() at:

assert(DISubprogram(Scope).describes(MF->getFunction()));

This would only occur when function inlining was activated. After debugging
into this, it turns out the inlining pass leaves the debug source location info
in a state the is not properly handled by the LexicalScopes class:

The fixupLineNumbers() function in lib/Transforms/Utils/InlineFunction.cpp will
not modify debug locations *at all* if the source location of the call-site is
unknown. Because of this the instructions copied from the callee into the
caller are still associated to the callee source location, but without having
the additional InlinedAt data. The LexicalScopes class will then not know that
this is actually valid code it is dealing with.

As a quick fix, I modified the fixupLineNumbers() function to clear all debug
location information from inlined instructions if the call-site has no debug
location info attached. This solved the problem but is a bit of a crude
solution. I'm sure you people can come up with something better!</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>