https://bugs.llvm.org/show_bug.cgi?id=45720
Bug ID: 45720
Summary: Attribute "cold" not permitted on Blocks language
extension
Product: clang
Version: 10.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: c...@freebsd.org
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
It seems like block code is function-like enough that it makes sense to be able
to annotate the objects with __attribute__((cold)) (or hot). Currently this is
rejected by Basic/Attr.td due to Cold/Hot SubjectLists containing only
"Function." And I'm sure some support would be needed internally to actually
map hot/cold attributes to meaningful behavior internally.
My observation is that:
1. Blocks are useful for generating known-cold code via macros, such as in
assert or (conditional) debug-level log constructs.
2. Clang attempts to inline all blocks.
3. Even when blocks are not inlined, they are laid out adjacent to their parent
function in .text.
The desired behavior of cold-attribute Blocks is basically that the cold
attribute is passed down to the generated LLVM function corresponding to Block
invocation. This affects NeverInline (2) and perhaps code placement (3).
As a giant kludge for (3), it seems to work to use -ffunction-sections to put
non-inlined blocks in their own sections and carefully use a linker script to
place them far away from other code. I don't have any good workarounds for
(2).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs