|
6 | 6 | ; RUN: llc -stop-after=finalize-isel -min-jump-table-entries=2 %s -o %t.mir |
7 | 7 | ; RUN: llc --run-pass=static-data-splitter -stats -x mir %t.mir -o - 2>&1 | FileCheck %s --check-prefix=STAT |
8 | 8 |
|
9 | | -; RUN: llc -enable-split-machine-functions -split-static-data -emit-static-data-hotness-suffix=true -function-sections -min-jump-table-entries=2 -disable-block-placement %s -o - 2>&1 | FileCheck %s --check-prefix=SECTION |
10 | | - |
11 | | -; Tests stat messages are expected. |
12 | | -; TODO: Update test to verify section suffixes when target-lowering and assembler changes are implemented. |
13 | | -; TODO: Also run static-data-splitter pass with -static-data-default-hotness=cold and check data section suffix. |
| 9 | +; When 'partition-static-data-sections' is enabled, static data splitter pass will |
| 10 | +; categorize jump tables and assembly printer will place hot jump tables in the |
| 11 | +; `.hot`-suffixed read only section, and cold ones in the `.rodata` sections. |
| 12 | +; Section names will optionally have `.<func>` if -function-sections is enabled. |
| 13 | +; RUN: llc -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,HOT |
| 14 | +; RUN: llc -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 |
| 15 | + |
| 16 | +; Tests that jump tables with unknown hotness are categorized as cold if `-static-data-default-hotness` specifies so. |
| 17 | +; RUN: llc -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,DEFAULT |
14 | 18 |
|
| 19 | + ; Tests stat messages are expected. |
15 | 20 | ; STAT-DAG: 2 static-data-splitter - Number of cold jump tables seen |
16 | | -; STAT-DAG: 3 static-data-splitter - Number of hot jump tables seen |
| 21 | +; STAT-DAG: 2 static-data-splitter - Number of hot jump tables seen |
17 | 22 | ; STAT-DAG: 1 static-data-splitter - Number of jump tables with unknown hotness |
18 | 23 |
|
19 | | -; SECTION: .section .rodata.hot.foo,"a",@progbits |
20 | | -; SECTION: .LJTI0_0: |
21 | | -; SECTION: .LJTI0_2: |
22 | | -; SECTION: .section .rodata.foo,"a",@progbits |
23 | | -; SECTION: .LJTI0_1: |
24 | | -; SECTION: .LJTI0_3: |
| 24 | +; Tests that the first and third jump table are placed in a hot-suffixed section, |
| 25 | +; and the second and fourth are placed in the original section. |
| 26 | +; FUNC: .section .rodata.hot.foo,"a",@progbits |
| 27 | +; FUNCLESS: .section .rodata.hot,"a",@progbits |
| 28 | +; JT: .LJTI0_0: |
| 29 | +; JT: .LJTI0_2: |
| 30 | +; FUNC: .section .rodata.foo,"a",@progbits |
| 31 | +; FUNCLESS: .section .rodata,"a",@progbits |
| 32 | +; JT: .LJTI0_1: |
| 33 | +; JT: .LJTI0_3: |
| 34 | +; HOT: .section .rodata.hot.func_without_entry_count,"a",@progbits |
| 35 | +; HOT: .LJTI1_0: |
| 36 | + |
| 37 | +; DEFAULT: .section .rodata.func_without_entry_count,"a",@progbits |
| 38 | +; DEFAULT: .LJTI1_0: |
25 | 39 |
|
26 | 40 | ; @foo has four jump tables, jt0, jt1, jt2 and jt3 in the input basic block |
27 | 41 | ; order; jt0 and jt2 are hot, and jt1 and jt3 are cold. |
@@ -142,42 +156,6 @@ return: |
142 | 156 | ret i32 %mod3 |
143 | 157 | } |
144 | 158 |
|
145 | | -define i32 @func_with_hot_jt() !prof !15 { |
146 | | -entry: |
147 | | - br label %for.body |
148 | | - |
149 | | -for.cond.cleanup: |
150 | | - ret i32 0 |
151 | | - |
152 | | -for.body: |
153 | | - %lsr.iv = phi i32 [ 100000, %entry ], [ %lsr.iv.next, %loop.exit ] |
154 | | - %i.04 = phi i32 [ 0, %entry ], [ %inc, %loop.exit ] |
155 | | - %0 = urem i32 %i.04, 100 |
156 | | - switch i32 %0, label %sw.default [ |
157 | | - i32 1, label %loop.exit |
158 | | - i32 2, label %sw.bb1.i |
159 | | - i32 3, label %sw.bb3.i |
160 | | - ], !prof !19 |
161 | | - |
162 | | -sw.bb1.i: |
163 | | - br label %loop.exit |
164 | | - |
165 | | -sw.bb3.i: |
166 | | - call i32 (ptr, ...) @printf(ptr @case1) |
167 | | - br label %sw.default |
168 | | - |
169 | | -sw.default: |
170 | | - br label %loop.exit |
171 | | - |
172 | | -loop.exit: |
173 | | - %str.5.sink.i = phi ptr [ @str.10, %sw.default ], [ @str.9, %sw.bb1.i ], [ @case2, %for.body ] |
174 | | - call i32 @puts(ptr %str.5.sink.i) |
175 | | - %inc = add i32 %i.04, 1 |
176 | | - %lsr.iv.next = add i32 %lsr.iv, -1 |
177 | | - %exitcond.not = icmp eq i32 %lsr.iv.next, 0 |
178 | | - br i1 %exitcond.not, label %for.body, label %for.cond.cleanup, !prof !17 |
179 | | -} |
180 | | - |
181 | 159 | define void @func_without_entry_count(i32 %num) { |
182 | 160 | entry: |
183 | 161 | switch i32 %num, label %sw.default [ |
|
0 commit comments