1717; DEFAULT: .section .rodata.func_without_profile,"a",@progbits
1818; DEFAULT: .LJTI1_0:
1919; DEFAULT: .section .rodata.bar_prefix.bar,"a",@progbits
20- ; DEFAULT: .LJTI2_0
21-
22- ; RUN: llc -mtriple=aarch64-unknown-linux-gnu -enable-split-machine-functions \
23- ; RUN: -partition-static-data-sections=true -function-sections=true \
20+ ; DEFAULT: .LJTI2_0
21+
22+ ; Test that section names are uniqufied by numbers but not function names with
23+ ; {-function-sections, -unique-section-names=false}. Specifically, @foo jump
24+ ; tables are emitted in two sections, one with unique ID 2 and the other with
25+ ; unique ID 3.
26+ ; RUN: llc -mtriple=aarch64-unknown-linux-gnu -partition-static-data-sections \
27+ ; RUN: -function-sections -unique-section-names=false \
2428; RUN: -aarch64-enable-atomic-cfg-tidy=false -aarch64-min-jump-table-entries=2 \
25- ; RUN: -unique-section-names=false %s -o - 2>&1 | FileCheck %s --check-prefixes=NUM,JT
29+ ; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=NUM,JT
2630
27- ; Section names will optionally have `.<func>` if -function-sections is enabled .
28- ; RUN: llc -mtriple=aarch64-unknown-linux-gnu -enable-split-machine-functions \
29- ; RUN: -partition-static-data- sections=true -function-sections=true \
31+ ; Section names will optionally have `.<func>` with { -function-sections, -unique-section-names} .
32+ ; RUN: llc -mtriple=aarch64-unknown-linux-gnu -partition-static-data-sections \
33+ ; RUN: -function- sections -unique-section-names \
3034; RUN: -aarch64-enable-atomic-cfg-tidy=false -aarch64-min-jump-table-entries=2 \
3135; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNC,JT
3236
33- ; RUN: llc -mtriple=aarch64-unknown-linux-gnu -enable-split-machine-functions \
34- ; RUN: -partition-static-data-sections=true -function-sections=false \
37+ ; Test that section names won't have `.<func>` with -function-sections=false.
38+ ; RUN: llc -mtriple=aarch64-unknown-linux-gnu -partition-static-data-sections \
39+ ; RUN: -function-sections=false \
3540; RUN: -aarch64-enable-atomic-cfg-tidy=false -aarch64-min-jump-table-entries=2 \
3641; RUN: %s -o - 2>&1 | FileCheck %s --check-prefixes=FUNCLESS,JT
3742
38- ; A function's section prefix is used for all jump tables of this function.
39- ; @foo is hot so its jump table data section has a hot prefix.
40- ; NUM: .section .rodata.hot.,"a",@progbits,unique,2
41- ; FUNC: .section .rodata.hot.foo,"a",@progbits
42- ; FUNCLESS: .section .rodata.hot.,"a",@progbits
43- ; JT: .LJTI0_0:
44- ; JT: .LJTI0_1:
45- ; JT: .LJTI0_2:
46- ; JT: .LJTI0_3:
47-
48- ; func_without_profile doesn't have profiles, so its jumptable doesn't have
49- ; hotness-based prefix.
50- ; NUM: .section .rodata,"a",@progbits,unique,4
51- ; FUNC: .section .rodata.func_without_profile,"a",@progbits
52- ; FUNCLESS: .section .rodata,"a",@progbits
53- ; JT: .LJTI1_0:
54-
55- ; @bar doesn't have profile information and it has a section prefix.
56- ; Tests that its jump tables are placed in sections with function prefixes.
57- ; NUM: .section .rodata.bar_prefix.,"a",@progbits,unique,
58- ; FUNC: .section .rodata.bar_prefix.bar
59- ; FUNCLESS: .section .rodata.bar_prefix.,"a"
60- ; JT: .LJTI2_0
61-
6243target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
6344target triple = "aarch64-unknown-linux-gnu"
6445
@@ -71,6 +52,19 @@ target triple = "aarch64-unknown-linux-gnu"
7152@default = private constant [8 x i8 ] c "default\00 "
7253@jt3 = private constant [4 x i8 ] c "jt3\00 "
7354
55+ ; A function's section prefix is used for all jump tables of this function.
56+ ; @foo is hot so its jump table data section has a hot prefix.
57+ ; NUM: .section .rodata.hot.,"a",@progbits,unique,2
58+ ; FUNC: .section .rodata.hot.foo,"a",@progbits
59+ ; FUNCLESS: .section .rodata.hot.,"a",@progbits
60+ ; JT: .LJTI0_0:
61+ ; JT: .LJTI0_2:
62+ ; NUM: .section .rodata.hot.,"a",@progbits,unique,3
63+ ; FUNC-NOT: .section .rodata.hot.foo
64+ ; FUNCLESS-NOT: .section .rodata.hot.,"a",@progbits
65+ ; JT: .LJTI0_1:
66+ ; JT: .LJTI0_3:
67+
7468; jt0 and jt2 are hot. jt1 and jt3 are cold.
7569define i32 @foo (i32 %num ) !prof !13 {
7670entry:
@@ -168,6 +162,12 @@ return:
168162 ret i32 %mod3
169163}
170164
165+ ; @func_without_profile doesn't have profiles, so its jumptable doesn't have
166+ ; hotness-based prefix.
167+ ; NUM: .section .rodata,"a",@progbits,unique,5
168+ ; FUNC: .section .rodata.func_without_profile,"a",@progbits
169+ ; FUNCLESS: .section .rodata,"a",@progbits
170+ ; JT: .LJTI1_0:
171171define void @func_without_profile (i32 %num ) {
172172entry:
173173 switch i32 %num , label %sw.default [
@@ -191,6 +191,12 @@ sw.epilog:
191191 ret void
192192}
193193
194+ ; @bar doesn't have profile information and it has a section prefix.
195+ ; Tests that its jump tables are placed in sections with function prefixes.
196+ ; NUM: .section .rodata.bar_prefix.,"a",@progbits,unique,7
197+ ; FUNC: .section .rodata.bar_prefix.bar
198+ ; FUNCLESS: .section .rodata.bar_prefix.,"a"
199+ ; JT: .LJTI2_0
194200define void @bar (i32 %num ) !section_prefix !20 {
195201entry:
196202 switch i32 %num , label %sw.default [
0 commit comments