[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:59 PST 2025


================
@@ -6,18 +6,49 @@
 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -stop-after=finalize-isel -min-jump-table-entries=2 %s -o %t.mir
 ; RUN: llc -mtriple=x86_64-unknown-linux-gnu --run-pass=static-data-splitter -stats -x mir %t.mir -o - 2>&1 | FileCheck %s --check-prefix=STAT
 
-; Tests stat messages are expected.
-; COM: Update test to verify section suffixes when target-lowering and assembler changes are implemented.
-; COM: Also run static-data-splitter pass with -static-data-default-hotness=cold and check data section suffix.
- 
+; In function @foo, the 2 switch instructions to jt0.* and jt1.* get lowered to
+; hot jump tables, and the 2 switch instructions to jt2.* and jt3.* get lowered
+; to cold jump tables.
+
+; @func_without_entry_count simulates the functions without profile information
+; (e.g., not instrumented or not profiled), it's jump table hotness is unknown.
+
+ ; Tests stat messages are expected.
 ; STAT: 2 static-data-splitter - Number of cold jump tables seen
 ; STAT: 2 static-data-splitter - Number of hot jump tables seen
 ; STAT: 1 static-data-splitter - Number of jump tables with unknown hotness
 
-; In function @foo, the 2 switch instructions to jt0.* and jt1.* get lowered to hot jump tables,
-; and the 2 switch instructions to jt2.* and jt3.* get lowered to cold jump tables.
-
-; @func_without_profile doesn't have profiles. It's jump table hotness is unknown.
+; Hot jump tables are in the `.rodata.hot`-prefixed section, and cold ones in
+; the `.rodata.unlikely`-prefixed section. In the function without profile
+; information, jump table section is `rodata` without hot or unlikely prefix.
----------------
snehasish wrote:

For the unknown case, it might be better to preserve the original behaviour with function prefix (though it should end up in the rodata section ultimately). Wdyt?

https://github.com/llvm/llvm-project/pull/122215


More information about the llvm-commits mailing list