[llvm] [AsmPrinter][ELF] Support profile-guided section prefix for jump tables' (read-only) data sections (PR #122215)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 28 14:00:58 PST 2025
================
@@ -669,7 +671,15 @@ getELFSectionNameForGlobal(const GlobalObject *GO, SectionKind Kind,
bool HasPrefix = false;
if (const auto *F = dyn_cast<Function>(GO)) {
- if (std::optional<StringRef> Prefix = F->getSectionPrefix()) {
+ // Jump table hotness takes precedence over its enclosing function's hotness
+ // if both are available.
+ if (JTE) {
+ if (JTE->Hotness == MachineFunctionDataHotness::Hot) {
+ raw_svector_ostream(Name) << ".hot";
+ } else if (JTE->Hotness == MachineFunctionDataHotness::Cold) {
+ raw_svector_ostream(Name) << ".unlikely";
+ }
----------------
snehasish wrote:
What will happen to the case where `JTE->Hotness == MachineFunctionDataHotness::Unknown`? I think the behaviour we want is to fall back to the section prefix. Can you add a test if you agree?
https://github.com/llvm/llvm-project/pull/122215
More information about the llvm-commits
mailing list