21
21
# RUN: llvm - profdata merge a.proftext - o a.profdata
22
22
# RUN: ld.lld a.o -- irpgo - profile=a.profdata -- bp - startup - sort=function -- verbose - bp - section - orderer -- icf=all -- gc - sections 2 >& 1 | FileCheck %s -- check - prefix=STARTUP - FUNC - ORDER
23
23
24
- # STARTUP - FUNC - ORDER: Ordered 3 sections ( [[ # ]] bytes) using balanced partitioning
25
- # STARTUP - FUNC - ORDER: Total area under the page fault curve: 3 .
24
+ # STARTUP - FUNC - ORDER: Ordered 4 sections ( [[ # ]] bytes) using balanced partitioning
25
+ # STARTUP - FUNC - ORDER: Total area under the page fault curve: 4 .
26
26
27
27
# RUN: ld.lld - o out .s a.o -- irpgo - profile=a.profdata -- bp - startup - sort=function
28
28
# RUN: llvm - nm - jn out .s | tr '\n' , | FileCheck %s -- check - prefix=STARTUP
29
- # STARTUP: s5 , s4 , s3 , s2 , s1 , A , B , C , F , E , D , merged1 , merged2 , _start , d4 , d3 , d2 , d1 , g1 , {{$}}
29
+ # STARTUP: s5 , s4 , s3 , s2 , s1 , A , B , C , L1 , F , E , D , merged1 , merged2 , G , _start , d4 , d3 , d2 , d1 , g1 , {{$}}
30
30
31
31
# RUN: ld.lld - o out .os a.o -- irpgo - profile=a.profdata -- bp - startup - sort=function -- symbol - ordering - file a.txt
32
32
# RUN: llvm - nm - jn out .os | tr '\n' , | FileCheck %s -- check - prefix=ORDER - STARTUP
33
- # ORDER - STARTUP: s2 , s1 , s5 , s4 , s3 , A , F , E , D , B , C , merged1 , merged2 , _start , d3 , d2 , d4 , d1 , g1 , {{$}}
33
+ # ORDER - STARTUP: s2 , s1 , s5 , s4 , s3 , A , F , E , D , B , C , L1 , merged1 , merged2 , G , _start , d3 , d2 , d4 , d1 , g1 , {{$}}
34
34
35
35
# RUN: ld.lld - o out .cf a.o -- verbose - bp - section - orderer -- bp - compression - sort=function 2 >& 1 | FileCheck %s -- check - prefix= BP - COMPRESSION - FUNC
36
36
# RUN: ld.lld - o out .cf.icf a.o -- verbose - bp - section - orderer -- bp - compression - sort=function -- icf=all -- gc - sections 2 >& 1 | FileCheck %s -- check - prefix= BP - COMPRESSION - ICF - FUNC
37
37
# RUN: llvm - nm - jn out .cf | tr '\n' , | FileCheck %s -- check - prefix=CFUNC
38
- # CFUNC: s5 , s4 , s3 , s2 , s1 , A , F , merged1 , merged2 , C , E , D , B , _start , d4 , d3 , d2 , d1 , g1 , {{$}}
38
+ # CFUNC: s5 , s4 , s3 , s2 , s1 , C , E , D , B , G , F , merged1 , merged2 , A , _start , L1 , d4 , d3 , d2 , d1 , g1 , {{$}}
39
39
40
40
# RUN: ld.lld - o out .cd a.o -- verbose - bp - section - orderer -- bp - compression - sort=data 2 >& 1 | FileCheck %s -- check - prefix= BP - COMPRESSION - DATA
41
41
# RUN: llvm - nm - jn out .cd | tr '\n' , | FileCheck %s -- check - prefix=CDATA
42
- # CDATA: s5 , s3 , s4 , s2 , s1 , F , C , E , D , B , A , merged1 , merged2 , _start , d4 , d1 , d3 , d2 , g1 , {{$}}
42
+ # CDATA: s5 , s3 , s4 , s2 , s1 , F , C , E , D , B , A , merged1 , merged2 , L1 , G , _start , d4 , d1 , d3 , d2 , g1 , {{$}}
43
43
44
44
# RUN: ld.lld - o out .cb a.o -- verbose - bp - section - orderer -- bp - compression - sort=both 2 >& 1 | FileCheck %s -- check - prefix= BP - COMPRESSION - BOTH
45
45
# RUN: llvm - nm - jn out .cb | tr '\n' , | FileCheck %s -- check - prefix=CBOTH
46
- # CBOTH: s5 , s3 , s4 , s2 , s1 , A , F , merged1 , merged2 , C , E , D , B , _start , d4 , d1 , d3 , d2 , g1 , {{$}}
46
+ # CBOTH: s5 , s3 , s4 , s2 , s1 , C , E , D , B , G , F , merged1 , merged2 , A , _start , L1 , d4 , d1 , d3 , d2 , g1 , {{$}}
47
47
48
48
# RUN: ld.lld - o out .cbs a.o -- verbose - bp - section - orderer -- bp - compression - sort=both -- irpgo - profile=a.profdata -- bp - startup - sort=function 2 >& 1 | FileCheck %s -- check - prefix= BP - COMPRESSION - BOTH
49
49
# RUN: llvm - nm - jn out .cbs | tr '\n' , | FileCheck %s -- check - prefix=CBOTH - STARTUP
50
- # CBOTH - STARTUP: s5 , s3 , s4 , s2 , s1 , A , B , C , F , E , D , merged1 , merged2 , _start , d4 , d1 , d3 , d2 , g1 , {{$}}
50
+ # CBOTH - STARTUP: s5 , s3 , s4 , s2 , s1 , A , B , C , L1 , F , E , D , merged1 , merged2 , G , _start , d4 , d1 , d3 , d2 , g1 , {{$}}
51
51
52
- # BP - COMPRESSION - FUNC: Ordered 9 sections ( [[ # ]] bytes) using balanced partitioning
53
- # BP - COMPRESSION - ICF - FUNC: Ordered 8 sections ( [[ # ]] bytes) using balanced partitioning
52
+ # BP - COMPRESSION - FUNC: Ordered 11 sections ( [[ # ]] bytes) using balanced partitioning
53
+ # BP - COMPRESSION - ICF - FUNC: Ordered 9 sections ( [[ # ]] bytes) using balanced partitioning
54
54
# BP - COMPRESSION - DATA: Ordered 9 sections ( [[ # ]] bytes) using balanced partitioning
55
- # BP - COMPRESSION - BOTH: Ordered 18 sections ( [[ # ]] bytes) using balanced partitioning
55
+ # BP - COMPRESSION - BOTH: Ordered 20 sections ( [[ # ]] bytes) using balanced partitioning
56
56
57
57
# --- a.proftext
58
58
:ir
63
63
1
64
64
# Weight
65
65
1
66
- A , B , C
66
+ A , B , C , L1
67
67
68
68
A
69
69
# Func Hash:
97
97
# Counter Values:
98
98
1
99
99
100
+ L1
101
+ # Func Hash:
102
+ 5555
103
+ # Num Counters:
104
+ 1
105
+ # Counter Values:
106
+ 1
107
+
100
108
# --- a.txt
101
109
A
102
110
F
@@ -137,6 +145,9 @@ void A() {}
137
145
RETAIN int merged1( int a) { return F(a + 101 ) ; }
138
146
int merged2( int a) { return F(a + 101 ) ; }
139
147
148
+ RETAIN static int L1( int a) { return a + 103 ; }
149
+ int G( int a) { return L1(a) ; }
150
+
140
151
int _start() { return 0 ; }
141
152
142
153
# --- gen
@@ -148,7 +159,7 @@ clang --target=aarch64-linux-gnu -O0 -ffunction-sections -fdata-sections -fno-as
148
159
.p2align 2
149
160
.type F , @function
150
161
F: // @F
151
- // %bb. 0 : // %entry
162
+ // %bb. 0 :
152
163
sub sp , sp , # 32
153
164
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
154
165
add x29 , sp , # 16
@@ -167,7 +178,7 @@ F: // @F
167
178
.p2align 2
168
179
.type C , @function
169
180
C: // @C
170
- // %bb. 0 : // %entry
181
+ // %bb. 0 :
171
182
sub sp , sp , # 32
172
183
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
173
184
add x29 , sp , # 16
@@ -186,7 +197,7 @@ C: // @C
186
197
.p2align 2
187
198
.type E , @function
188
199
E: // @E
189
- // %bb. 0 : // %entry
200
+ // %bb. 0 :
190
201
sub sp , sp , # 32
191
202
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
192
203
add x29 , sp , # 16
@@ -205,7 +216,7 @@ E: // @E
205
216
.p2align 2
206
217
.type D , @function
207
218
D: // @D
208
- // %bb. 0 : // %entry
219
+ // %bb. 0 :
209
220
sub sp , sp , # 32
210
221
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
211
222
add x29 , sp , # 16
@@ -224,7 +235,7 @@ D: // @D
224
235
.p2align 2
225
236
.type B , @function
226
237
B: // @B
227
- // %bb. 0 : // %entry
238
+ // %bb. 0 :
228
239
sub sp , sp , # 32
229
240
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
230
241
add x29 , sp , # 16
@@ -243,7 +254,7 @@ B: // @B
243
254
.p2align 2
244
255
.type A , @function
245
256
A: // @A
246
- // %bb. 0 : // %entry
257
+ // %bb. 0 :
247
258
ret
248
259
.Lfunc_end5:
249
260
.size A , .Lfunc_end5 - A
@@ -253,7 +264,7 @@ A: // @A
253
264
.p2align 2
254
265
.type merged1 , @function
255
266
merged1: // @merged1
256
- // %bb. 0 : // %entry
267
+ // %bb. 0 :
257
268
sub sp , sp , # 32
258
269
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
259
270
add x29 , sp , # 16
@@ -272,7 +283,7 @@ merged1: // @merged1
272
283
.p2align 2
273
284
.type merged2 , @function
274
285
merged2: // @merged2
275
- // %bb. 0 : // %entry
286
+ // %bb. 0 :
276
287
sub sp , sp , # 32
277
288
stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
278
289
add x29 , sp , # 16
@@ -286,16 +297,48 @@ merged2: // @merged2
286
297
.Lfunc_end7:
287
298
.size merged2 , .Lfunc_end7 - merged2
288
299
// -- End function
300
+ . section .text.L1 , "axR" , @progbits
301
+ .p2align 2 // -- Begin function L1
302
+ .type L1 , @function
303
+ L1: // @L1
304
+ // %bb. 0 :
305
+ sub sp , sp , # 16
306
+ str w0 , [ sp , # 12 ]
307
+ ldr w8 , [ sp , # 12 ]
308
+ add w0 , w8 , # 103
309
+ add sp , sp , # 16
310
+ ret
311
+ .Lfunc_end8:
312
+ .size L1 , .Lfunc_end8 - L1
313
+ // -- End function
314
+ . section .text.G , "ax" , @progbits
315
+ .globl G // -- Begin function G
316
+ .p2align 2
317
+ .type G , @function
318
+ G: // @G
319
+ // %bb. 0 :
320
+ sub sp , sp , # 32
321
+ stp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Spill
322
+ add x29 , sp , # 16
323
+ stur w0 , [ x29 , # - 4 ]
324
+ ldur w0 , [ x29 , # - 4 ]
325
+ bl L1
326
+ ldp x29 , x30 , [ sp , # 16 ] // 16 - byte Folded Reload
327
+ add sp , sp , # 32
328
+ ret
329
+ .Lfunc_end9:
330
+ .size G , .Lfunc_end9 - G
331
+ // -- End function
289
332
. section .text._start , "ax" , @progbits
290
333
.globl _start // -- Begin function _start
291
334
.p2align 2
292
335
.type _start , @function
293
336
_start: // @_start
294
- // %bb. 0 : // %entry
337
+ // %bb. 0 :
295
338
mov w0 , wzr
296
339
ret
297
- .Lfunc_end8 :
298
- .size _start , .Lfunc_end8 - _start
340
+ .Lfunc_end10 :
341
+ .size _start , .Lfunc_end10 - _start
299
342
// -- End function
300
343
.type s5 , @object // @s5
301
344
. section .rodata.s5 , "a" , @progbits
395
438
.addrsig_sym B
396
439
.addrsig_sym A
397
440
.addrsig_sym merged1
441
+ .addrsig_sym L1
0 commit comments