<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_ASSIGNED "
title="ASSIGNED --- - Support metadata attachments on functions"
href="https://llvm.org/bugs/show_bug.cgi?id=23340">23340</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Support metadata attachments on functions
</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>ASSIGNED
</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>dblaikie@gmail.com, dnovillo@google.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>`Function` definitions should support `MDNode` attachments, with a
similar syntax to instructions:
define void @foo() nounwind !attach !0 {
unreachable
}
!0 = !{}
Attachments wouldn't be allowed on declarations, just definitions.
There are two open problems this can help with:
1. For PGO, we need somewhere to attach the function entry count.
Attaching to the function definition is a simple solution.
define void @foo() !prof !0 {
unreachable
}
!0 = !{i32 987}
2. In debug info, we repeatedly build up a map from `Function` to the
canonical `MDSubrogram` for it. Keeping this mapping accurate takes
subtle logic in `lib/Linker` (see PR21910/PR22792) and it's
expensive to compute and maintain. Attaching it directly to the
`Function` designs away the problem.
define void @foo() !dbg !0 {
unreachable
}
!0 = !MDSubprogram(name: "foo", function: void ()* @foo)
(For clarity, the scope of this PR is adding the IR infrastructure, not solving
either of those two problems.)
Discussion on the list was here:
<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/084483.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/084483.html</a>
<a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/084485.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/084485.html</a>
For now, I'm just going to put everything in the `LLVMContext`: same approach
as `Instruction`, but without the optimization for `!dbg`. If a heap profile
tells us we should special-case `!dbg` we can add that logic later.</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>