21
21
# RUN: ld.lld a.o -- irpgo - profile=a.profdata -- bp - startup - sort=function -- verbose - bp - section - orderer -- icf=all 2 >& 1 | FileCheck %s -- check - prefix=STARTUP - FUNC - ORDER
22
22
23
23
# STARTUP - FUNC - ORDER: Ordered 3 sections using balanced partitioning
24
+ # STARTUP - FUNC - ORDER: Total area under the page fault curve: 3 .
24
25
25
- # RUN: ld.lld - o - a.o -- symbol - ordering - file a.orderfile -- irpgo - profile=a.profdata -- bp - startup - sort=function | llvm - nm -- numeric - sort -- form at =just - symbols - | FileCheck %s -- check - prefix=ORDERFILE
26
- # RUN: ld.lld - o - a.o -- symbol - ordering - file a.orderfile -- bp - compression - sort=both | llvm - nm -- numeric - sort -- form at =just - symbols - | FileCheck %s -- check - prefix=ORDERFILE
26
+ # RUN: ld.lld - o - a.o -- symbol - ordering - file a.txt -- irpgo - profile=a.profdata -- bp - startup - sort=function | llvm - nm -- numeric - sort -- form at =just - symbols - | FileCheck %s -- check - prefix=ORDERFILE
27
+ # RUN: ld.lld - o - a.o -- symbol - ordering - file a.txt -- bp - compression - sort=both | llvm - nm -- numeric - sort -- form at =just - symbols - | FileCheck %s -- check - prefix=ORDERFILE
27
28
28
29
## Rodata
29
30
# ORDERFILE: s2
35
36
# ORDERFILE - NEXT: F
36
37
# ORDERFILE - NEXT: E
37
38
# ORDERFILE - NEXT: D
38
- # ORDERFILE - NEXT : B
39
- # ORDERFILE - NEXT : C
39
+ # ORDERFILE - DAG : B
40
+ # ORDERFILE - DAG : C
40
41
# ORDERFILE - NEXT: _start
41
42
42
43
## Data
97
98
# Counter Values:
98
99
1
99
100
100
- # --- a.orderfile
101
+ # --- a.txt
101
102
A
102
103
F
103
104
E
@@ -115,77 +116,80 @@ const char *r1 = s1;
115
116
const char ** r2 = &r1 ;
116
117
const char *** r3 = &r2 ;
117
118
const char * r4 = s2 ;
118
- void A() { return ; }
119
119
120
- int B( int a) {
121
- A() ;
122
- return a + 1 ;
123
- }
124
-
125
- int C( int a) {
126
- A() ;
127
- return a + 2 ;
128
- }
129
-
130
- int D( int a) { return B(a + 2 ) ; }
131
-
132
- int E( int a) { return C(a + 2 ) ; }
120
+ int C( int a) ;
121
+ int B( int a) ;
122
+ void A() ;
133
123
134
124
int F( int a) { return C(a + 3 ) ; }
125
+ int E( int a) { return C(a + 2 ) ; }
126
+ int D( int a) { return B(a + 2 ) ; }
127
+ int C( int a) { A() ; return a + 2; }
128
+ int B( int a) { A() ; return a + 1; }
129
+ void A() {}
135
130
136
131
int _start() { return 0 ; }
137
132
138
133
# --- gen
139
134
clang -- target=aarch64 - linux - gnu - O0 - ffunction - sections - fdata - sections - fno - asynchronous - unwind - tables - S a.c - o -
140
135
;--- a.s
141
136
.file "a.c"
142
- . section .text.A , "ax" , @progbits
143
- .globl A // -- Begin function A
137
+ . section .text.F , "ax" , @progbits
138
+ .globl F // -- Begin function F
144
139
.p2align 2
145
- .type A , @function
146
- A : // @A
140
+ .type F , @function
141
+ F : // @F
147
142
// %bb. 0 : // %entry
143
+ sub sp , sp , # 32
144
+ stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
145
+ add x29 , sp , # 16
146
+ stur w0 , [ x29 , # - 4 ]
147
+ ldur w8 , [ x29 , # - 4 ]
148
+ add w0 , w8 , # 3
149
+ bl C
150
+ ldp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Reload
151
+ add sp , sp , # 32
148
152
ret
149
153
.Lfunc_end0:
150
- .size A , .Lfunc_end0 - A
154
+ .size F , .Lfunc_end0 - F
151
155
// -- End function
152
- . section .text.B , "ax" , @progbits
153
- .globl B // -- Begin function B
156
+ . section .text.C , "ax" , @progbits
157
+ .globl C // -- Begin function C
154
158
.p2align 2
155
- .type B , @function
156
- B : // @B
159
+ .type C , @function
160
+ C : // @C
157
161
// %bb. 0 : // %entry
158
162
sub sp , sp , # 32
159
163
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
160
164
add x29 , sp , # 16
161
165
stur w0 , [ x29 , # - 4 ]
162
166
bl A
163
167
ldur w8 , [ x29 , # - 4 ]
164
- add w0 , w8 , # 1
168
+ add w0 , w8 , # 2
165
169
ldp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Reload
166
170
add sp , sp , # 32
167
171
ret
168
172
.Lfunc_end1:
169
- .size B , .Lfunc_end1 - B
173
+ .size C , .Lfunc_end1 - C
170
174
// -- End function
171
- . section .text.C , "ax" , @progbits
172
- .globl C // -- Begin function C
175
+ . section .text.E , "ax" , @progbits
176
+ .globl E // -- Begin function E
173
177
.p2align 2
174
- .type C , @function
175
- C : // @C
178
+ .type E , @function
179
+ E : // @E
176
180
// %bb. 0 : // %entry
177
181
sub sp , sp , # 32
178
182
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
179
183
add x29 , sp , # 16
180
184
stur w0 , [ x29 , # - 4 ]
181
- bl A
182
185
ldur w8 , [ x29 , # - 4 ]
183
186
add w0 , w8 , # 2
187
+ bl C
184
188
ldp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Reload
185
189
add sp , sp , # 32
186
190
ret
187
191
.Lfunc_end2:
188
- .size C , .Lfunc_end2 - C
192
+ .size E , .Lfunc_end2 - E
189
193
// -- End function
190
194
. section .text.D , "ax" , @progbits
191
195
.globl D // -- Begin function D
@@ -206,43 +210,34 @@ D: // @D
206
210
.Lfunc_end3:
207
211
.size D , .Lfunc_end3 - D
208
212
// -- End function
209
- . section .text.E , "ax" , @progbits
210
- .globl E // -- Begin function E
213
+ . section .text.B , "ax" , @progbits
214
+ .globl B // -- Begin function B
211
215
.p2align 2
212
- .type E , @function
213
- E : // @E
216
+ .type B , @function
217
+ B : // @B
214
218
// %bb. 0 : // %entry
215
219
sub sp , sp , # 32
216
220
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
217
221
add x29 , sp , # 16
218
222
stur w0 , [ x29 , # - 4 ]
223
+ bl A
219
224
ldur w8 , [ x29 , # - 4 ]
220
- add w0 , w8 , # 2
221
- bl C
225
+ add w0 , w8 , # 1
222
226
ldp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Reload
223
227
add sp , sp , # 32
224
228
ret
225
229
.Lfunc_end4:
226
- .size E , .Lfunc_end4 - E
230
+ .size B , .Lfunc_end4 - B
227
231
// -- End function
228
- . section .text.F , "ax" , @progbits
229
- .globl F // -- Begin function F
232
+ . section .text.A , "ax" , @progbits
233
+ .globl A // -- Begin function A
230
234
.p2align 2
231
- .type F , @function
232
- F : // @F
235
+ .type A , @function
236
+ A : // @A
233
237
// %bb. 0 : // %entry
234
- sub sp , sp , # 32
235
- stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
236
- add x29 , sp , # 16
237
- stur w0 , [ x29 , # - 4 ]
238
- ldur w8 , [ x29 , # - 4 ]
239
- add w0 , w8 , # 3
240
- bl C
241
- ldp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Reload
242
- add sp , sp , # 32
243
238
ret
244
239
.Lfunc_end5:
245
- .size F , .Lfunc_end5 - F
240
+ .size A , .Lfunc_end5 - A
246
241
// -- End function
247
242
. section .text._start , "ax" , @progbits
248
243
.globl _start // -- Begin function _start
310
305
311
306
. section ".note.GNU-stack" , "" , @progbits
312
307
.addrsig
313
- .addrsig_sym A
314
- .addrsig_sym B
315
308
.addrsig_sym C
309
+ .addrsig_sym B
310
+ .addrsig_sym A
316
311
.addrsig_sym s1
317
312
.addrsig_sym s2
318
313
.addrsig_sym r1
0 commit comments