<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 --- - Remove the inlinedAt: field from DI/MDLocalVariable"
   href="http://llvm.org/bugs/show_bug.cgi?id=22778">22778</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Remove the inlinedAt: field from DI/MDLocalVariable
          </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>dexonsmith@apple.com
          </td>
        </tr>

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

        <tr>
          <th>CC</th>
          <td>aprantl@apple.com, dblaikie@gmail.com, echristo@gmail.com, friss@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>21432
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We should remove the `inlinedAt:` field from local variables, now that the
specialized hierarchy is in place from <a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED --- - Debug Info IR: Add specialized nodes for DIDescriptor hierarchy"
   href="show_bug.cgi?id=22464">bug 22464</a>.

It's a horrible hack that `MDLocalVariable` has an `inlinedAt:` field.  It's
used to attach where the variable has been inlined to `!dbg.value` and
!dbg.declare` intrinsics, but that information is already attached via `!dbg`:

      call !dbg.value(..., metadata !1, ...), !dbg !2
    ; ...
    !1 = !MDLocalVariable(..., inlinedAt: !3)
    !2 = !MDLocation(..., inlinedAt: !3)
    !3 = !MDLocation(...)

Moreover, creating these inlined copies of variables is expensive.  I recently
ran a clang -g -flto bootstrap; during LTO, calls to `createInlinedVariable()`
accounted for ~3% of the total memory allocated (almost 10% of the memory used
for IR).

Why don't we already use the `!dbg` attachments?  My understanding is that we
didn't used to be able to count on them being present and accurate, but
dblaikie has done (most of?) the work to make them so.

Known things left to do:

1. Keep track of `!dbg` attachments to `!dbg.declare`s in the MMI side-table.
2. Add assertions (in the verifier and in the backend) that for all debug
intrinsics, the `inlinedAt:` pointers match between the variable reference and
the `!dbg` attachment.
3. Teach the backend to use the `!dbg` attachments exclusively.
4. Remove `inlinedAt:` (and related API) from `MDLocalVariable`.</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>