Question:I wish to mark a function for more aggressive optimizations. The function is not called often, so PGO won’t help, but I still want it as low latency as possible.
gcc has attribute
hotfor this. Is there some clang equivalent I’m missing?
BTW clang does accept
__attribute__((hot)), but AFAICT it has zero impact (and is undocumented). Probably for source compatibility with gcc.
Answer:(Writing an answer instead of deleting, in case it is of use to others)
So turns out that since December 2020 Clang does support
__attribute__((hot)), they just didn’t document it. I nudged them. When tested in a newer clang version I see a difference in binaries.
BTW they did support
__attribute__((cold))long before that. And as I suspected, the clang front end did accept
hotfor sake of gcc compatibility.
If you have better answer, please add a comment about this, thank you!