Skip to content

Commit e33b00a

Browse files
authored
[InstrProf][lld] Extend test to confirm order_file takes precedense over BP (#118889)
When both `-order_file` and `--irpgo-profile-sort=` (soon to be `-bp-startup-sort=function` in #118594) are used, we want to confirm that symbols in the orderfile take precedence.
1 parent 244b207 commit e33b00a

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

lld/test/MachO/bp-section-orderer.s

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,36 @@
99

1010
# STARTUP: Ordered 3 sections using balanced partitioning
1111

12-
# RUN: %lld -arch arm64 -lSystem -e _main -o - %t/a.o --irpgo-profile-sort=%t/a.profdata -order_file %t/a.orderfile | llvm-nm --numeric-sort --format=just-symbols - | FileCheck %s --check-prefix=ORDERFILE
12+
# Check that orderfiles take precedence over BP
13+
# RUN: %lld -arch arm64 -lSystem -e _main -o - %t/a.o -order_file %t/a.orderfile --irpgo-profile-sort=%t/a.profdata | llvm-nm --numeric-sort --format=just-symbols - | FileCheck %s --check-prefix=ORDERFILE
14+
# RUN: %lld -arch arm64 -lSystem -e _main -o - %t/a.o -order_file %t/a.orderfile --compression-sort=both | llvm-nm --numeric-sort --format=just-symbols - | FileCheck %s --check-prefix=ORDERFILE
1315

16+
# Functions
1417
# ORDERFILE: A
1518
# ORDERFILE: F
1619
# ORDERFILE: E
1720
# ORDERFILE: D
1821
# ORDERFILE-DAG: _main
1922
# ORDERFILE-DAG: _B
2023
# ORDERFILE-DAG: l_C
24+
25+
# Data
26+
# ORDERFILE: s3
27+
# ORDERFILE: r3
28+
# ORDERFILE: r2
2129
# ORDERFILE-DAG: s1
2230
# ORDERFILE-DAG: s2
2331
# ORDERFILE-DAG: r1
24-
# ORDERFILE-DAG: r2
32+
# ORDERFILE-DAG: r4
2533

2634
# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --compression-sort=function 2>&1 | FileCheck %s --check-prefix=COMPRESSION-FUNC
2735
# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --compression-sort=data 2>&1 | FileCheck %s --check-prefix=COMPRESSION-DATA
2836
# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --compression-sort=both 2>&1 | FileCheck %s --check-prefix=COMPRESSION-BOTH
2937
# RUN: %lld -arch arm64 -lSystem -e _main -o %t/a.out %t/a.o --verbose-bp-section-orderer --compression-sort=both --irpgo-profile-sort=%t/a.profdata 2>&1 | FileCheck %s --check-prefix=COMPRESSION-BOTH
3038

3139
# COMPRESSION-FUNC: Ordered 7 sections using balanced partitioning
32-
# COMPRESSION-DATA: Ordered 4 sections using balanced partitioning
33-
# COMPRESSION-BOTH: Ordered 11 sections using balanced partitioning
40+
# COMPRESSION-DATA: Ordered 7 sections using balanced partitioning
41+
# COMPRESSION-BOTH: Ordered 14 sections using balanced partitioning
3442

3543
#--- a.s
3644
.text
@@ -66,10 +74,16 @@ s1:
6674
.ascii "hello world"
6775
s2:
6876
.ascii "i am a string"
77+
s3:
78+
.ascii "this is s3"
6979
r1:
7080
.quad s1
7181
r2:
7282
.quad r1
83+
r3:
84+
.quad r2
85+
r4:
86+
.quad s2
7387

7488
.subsections_via_symbols
7589

@@ -121,3 +135,6 @@ A
121135
F
122136
E
123137
D
138+
s3
139+
r3
140+
r2

0 commit comments

Comments
 (0)