================ @@ -3,21 +3,53 @@ ; Stop after 'finalize-isel' for simpler MIR, and lower the minimum number of ; jump table entries so 'switch' needs fewer cases to generate a jump table. -; RUN: llc -stop-after=finalize-isel -min-jump-table-entries=2 %s -o %t.mir -; RUN: llc --run-pass=static-data-splitter -stats -x mir %t.mir -o - 2>&1 | FileCheck %s --check-prefix=STAT +; 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. -; TODO: Update test to verify section suffixes when target-lowering and assembler changes are implemented. -; TODO: Also run static-data-splitter pass with -static-data-default-hotness=cold and check data section suffix. - + ; Tests stat messages are expected. ; STAT-DAG: 2 static-data-splitter - Number of cold jump tables seen ; STAT-DAG: 2 static-data-splitter - Number of hot jump tables seen ; STAT-DAG: 1 static-data-splitter - Number of jump tables with unknown hotness -; In function @foo, the 2 switch instructions to jt0.* and jt2.* get lowered to hot jump tables, -; and the 2 switch instructions to jt1.* and jt3.* get lowered to cold jump tables. - -; @func_without_profile doesn't have profiles. It's jump table hotness is unknown. +; When 'partition-static-data-sections' is enabled, static data splitter pass will +; categorize jump tables and assembly printer will place hot jump tables in the +; `.rodata.hot`-prefixed section, and cold ones in the `.rodata.unlikely`-prefixed section. +; Section names will optionally have `.<func>` if -function-sections is enabled. +; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions -partition-static-data-sections=true -function-sections=true -min-jump-table-entries=2 -unique-section-names=false %s -o - 2>&1 | FileCheck %s --check-prefixes=LINEAR,JT +; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions -partition-static-data-sections=true -function-sections=true -min-jump-table-entries=2 %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNC,JT,DEFAULTHOT +; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions -partition-static-data-sections=true -function-sections=false -min-jump-table-entries=2 %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNCLESS,JT --implicit-check-not=unique + +; Tests that `-static-data-default-hotness` can override hotness for data with +; unknown hotness. +; RUN: llc -mtriple=x86_64-unknown-linux-gnu -enable-split-machine-functions -partition-static-data-sections=true -min-jump-table-entries=2 -static-data-default-hotness=cold -function-sections=true %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNC,JT,DEFAULTCOLD + +; LINEAR: .section .rodata.hot,"a",@progbits,unique,2 +; FUNC: .section .rodata.hot.foo,"a",@progbits +; FUNCLESS: .section .rodata.hot,"a",@progbits +; JT: .LJTI0_0: +; JT: .LJTI0_2: +; LINEAR: .section .rodata.unlikely,"a",@progbits,unique,3 +; FUNC: .section .rodata.unlikely.foo,"a",@progbits +; FUNCLESS: .section .rodata.unlikely,"a",@progbits +; JT: .LJTI0_1: +; JT: .LJTI0_3: +; DEFAULTHOT: .section .rodata.hot.func_without_entry_count,"a",@progbits ---------------- williamweixiao wrote:
According referenced function is inside ".section .text.func_without_entry_count" but its data in ".section .rodata.hot.func_without_entry_count". There seems to be some inconsistency here. https://github.com/llvm/llvm-project/pull/122215 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits