https://llvm.org/bugs/show_bug.cgi?id=23340
Bug ID: 23340
Summary: Support metadata attachments on functions
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: ASSIGNED
Severity: normal
Priority: P
Component: Core LLVM classes
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
Classification: Unclassified
`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:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/084483.html
http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/084485.html
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs