Skip to content

Commit 85d39ff

Browse files
committed
reduce the assembly for x86&arm
1 parent 4e82b92 commit 85d39ff

File tree

2 files changed

+2
-92
lines changed

2 files changed

+2
-92
lines changed

bolt/test/AArch64/dwarf4-dwp-aarch64.s

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
## This test checks updating debuginfo via dwarf4 dwp file
12
# RUN: rm -rf %t && mkdir -p %t && cd %t
23
# RUN: split-file %s %t
34
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown --split-dwarf-file=main.exe-main.dwo %t/main.s -o %t/main.o
@@ -8,52 +9,19 @@
89

910
# CHECK-NOT: Assertion
1011

11-
#--- main.cpp
12-
int callee(int x);
13-
int main() { return callee(0); }
14-
#--- callee.cpp
15-
int callee(int x) { return x; }
16-
#--- gen
17-
clang++ --target=aarch64-unknown-unknown -c -g -gdwarf-4 -gsplit-dwarf -fdebug-compilation-dir=. -Xclang -split-dwarf-file -Xclang main.exe-main.dwo -S main.cpp -o -
18-
echo '#--- callee.s'
19-
clang++ --target=aarch64-unknown-unknown -c -g -gdwarf-4 -gsplit-dwarf -fdebug-compilation-dir=. -Xclang -split-dwarf-file -Xclang main.exe-callee.dwo -S callee.cpp -o -
2012
#--- main.s
2113
.file "main.cpp"
22-
.text
2314
.globl main // -- Begin function main
24-
.p2align 2
2515
.type main,@function
2616
main: // @main
2717
.Lfunc_begin0:
2818
.file 1 "." "main.cpp"
2919
.loc 1 2 0 // main.cpp:2:0
30-
.cfi_startproc
31-
// %bb.0: // %entry
32-
sub sp, sp, #32
33-
.cfi_def_cfa_offset 32
34-
stp x29, x30, [sp, #16] // 16-byte Folded Spill
35-
add x29, sp, #16
36-
.cfi_def_cfa w29, 16
37-
.cfi_offset w30, -8
38-
.cfi_offset w29, -16
39-
mov w0, wzr
40-
stur wzr, [x29, #-4]
41-
.Ltmp0:
4220
.loc 1 2 21 prologue_end // main.cpp:2:21
43-
bl _Z6calleei
44-
.cfi_def_cfa wsp, 32
4521
.loc 1 2 14 epilogue_begin is_stmt 0 // main.cpp:2:14
46-
ldp x29, x30, [sp, #16] // 16-byte Folded Reload
47-
add sp, sp, #32
48-
.cfi_def_cfa_offset 0
49-
.cfi_restore w30
50-
.cfi_restore w29
5122
ret
52-
.Ltmp1:
5323
.Lfunc_end0:
5424
.size main, .Lfunc_end0-main
55-
.cfi_endproc
56-
// -- End function
5725
.section .debug_abbrev,"",@progbits
5826
.byte 1 // Abbreviation Code
5927
.byte 17 // DW_TAG_compile_unit
@@ -225,31 +193,18 @@ main: // @main
225193
.Lline_table_start0:
226194
#--- callee.s
227195
.file "callee.cpp"
228-
.text
229196
.globl _Z6calleei // -- Begin function _Z6calleei
230-
.p2align 2
231197
.type _Z6calleei,@function
232198
_Z6calleei: // @_Z6calleei
233199
.Lfunc_begin0:
234200
.file 1 "." "callee.cpp"
235201
.loc 1 1 0 // callee.cpp:1:0
236202
.cfi_startproc
237-
// %bb.0: // %entry
238-
sub sp, sp, #16
239-
.cfi_def_cfa_offset 16
240-
str w0, [sp, #12]
241-
.Ltmp1:
242203
.loc 1 1 28 prologue_end // callee.cpp:1:28
243-
ldr w0, [sp, #12]
244204
.loc 1 1 21 epilogue_begin is_stmt 0 // callee.cpp:1:21
245-
add sp, sp, #16
246-
.cfi_def_cfa_offset 0
247205
ret
248-
.Ltmp2:
249206
.Lfunc_end0:
250207
.size _Z6calleei, .Lfunc_end0-_Z6calleei
251-
.cfi_endproc
252-
// -- End function
253208
.section .debug_abbrev,"",@progbits
254209
.byte 1 // Abbreviation Code
255210
.byte 17 // DW_TAG_compile_unit

bolt/test/X86/dwarf4-dwp-x86.s

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
## This test checks updating debuginfo via dwarf4 dwp file
12
# RUN: rm -rf %t && mkdir -p %t && cd %t
23
# RUN: split-file %s %t
34
# RUN: %clangxx -g -gdwarf-4 -gsplit-dwarf %t/main.s %t/callee.s -o main.exe
@@ -6,48 +7,19 @@
67

78
# CHECK-NOT: Assertion
89

9-
#--- main.cpp
10-
int callee(int x);
11-
int main() { return callee(0); }
12-
#--- callee.cpp
13-
int callee(int x) { return x; }
14-
#--- gen
15-
clang++ -c -g -gdwarf-4 -gsplit-dwarf -fdebug-compilation-dir=. -Xclang -split-dwarf-file -Xclang main.exe-main.dwo -S main.cpp -o -
16-
echo '#--- callee.s'
17-
clang++ -c -g -gdwarf-4 -gsplit-dwarf -fdebug-compilation-dir=. -Xclang -split-dwarf-file -Xclang main.exe-callee.dwo -S callee.cpp -o -
1810
#--- main.s
1911
.file "main.cpp"
20-
.text
2112
.globl main # -- Begin function main
22-
.p2align 4
2313
.type main,@function
2414
main: # @main
2515
.Lfunc_begin0:
2616
.file 1 "." "main.cpp"
2717
.loc 1 2 0 # main.cpp:2:0
28-
.cfi_startproc
29-
# %bb.0: # %entry
30-
pushq %rbp
31-
.cfi_def_cfa_offset 16
32-
.cfi_offset %rbp, -16
33-
movq %rsp, %rbp
34-
.cfi_def_cfa_register %rbp
35-
subq $16, %rsp
36-
movl $0, -4(%rbp)
37-
.Ltmp0:
3818
.loc 1 2 21 prologue_end # main.cpp:2:21
39-
xorl %edi, %edi
40-
callq _Z6calleei@PLT
4119
.loc 1 2 14 epilogue_begin is_stmt 0 # main.cpp:2:14
42-
addq $16, %rsp
43-
popq %rbp
44-
.cfi_def_cfa %rsp, 8
4520
retq
46-
.Ltmp1:
4721
.Lfunc_end0:
4822
.size main, .Lfunc_end0-main
49-
.cfi_endproc
50-
# -- End function
5123
.section .debug_abbrev,"",@progbits
5224
.byte 1 # Abbreviation Code
5325
.byte 17 # DW_TAG_compile_unit
@@ -219,34 +191,17 @@ main: # @main
219191
.Lline_table_start0:
220192
#--- callee.s
221193
.file "callee.cpp"
222-
.text
223194
.globl _Z6calleei # -- Begin function _Z6calleei
224-
.p2align 4
225195
.type _Z6calleei,@function
226196
_Z6calleei: # @_Z6calleei
227197
.Lfunc_begin0:
228198
.file 1 "." "callee.cpp"
229199
.loc 1 1 0 # callee.cpp:1:0
230-
.cfi_startproc
231-
# %bb.0: # %entry
232-
pushq %rbp
233-
.cfi_def_cfa_offset 16
234-
.cfi_offset %rbp, -16
235-
movq %rsp, %rbp
236-
.cfi_def_cfa_register %rbp
237-
movl %edi, -4(%rbp)
238-
.Ltmp0:
239200
.loc 1 1 28 prologue_end # callee.cpp:1:28
240-
movl -4(%rbp), %eax
241201
.loc 1 1 21 epilogue_begin is_stmt 0 # callee.cpp:1:21
242-
popq %rbp
243-
.cfi_def_cfa %rsp, 8
244202
retq
245-
.Ltmp1:
246203
.Lfunc_end0:
247204
.size _Z6calleei, .Lfunc_end0-_Z6calleei
248-
.cfi_endproc
249-
# -- End function
250205
.section .debug_abbrev,"",@progbits
251206
.byte 1 # Abbreviation Code
252207
.byte 17 # DW_TAG_compile_unit

0 commit comments

Comments
 (0)