Skip to content

Commit 7c3246f

Browse files
author
Ash Dobrescu
committed
Add pre-commit test
1 parent 299a55a commit 7c3246f

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// This test checks that BOLT does not split remember and restore CFI states
2+
// into different lists, which would cause an assertion failure.
3+
4+
# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
5+
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
6+
# RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
7+
8+
# CHECK: BOLT-INFO: Target architecture: aarch64
9+
# CHECK: BOLT-INFO: enabling relocation mode
10+
# CHECK-NOT: llvm-bolt:
11+
# CHECK: BOLT-INFO: Starting stub-insertion pass
12+
13+
.text
14+
.global main
15+
.type main, %function
16+
17+
main:
18+
.cfi_startproc
19+
.cfi_def_cfa_offset 16
20+
.cfi_offset x30, -8
21+
.cfi_remember_state
22+
mov x9, #0x3ff0000000000000
23+
mov x8, x0
24+
stp x30, x9, [sp, #-0x10]!
25+
add x3, sp, #0x8
26+
mov x0, x1
27+
mov x1, x2
28+
mov x2, x8
29+
bl main
30+
fcmp d0, #0.0
31+
b.ne main+0x34
32+
33+
mov w0, wzr
34+
ldr x30, [sp], #0x10
35+
.cfi_def_cfa_offset 0
36+
.cfi_restore x30
37+
38+
ret
39+
.cfi_restore_state
40+
.cfi_remember_state
41+
42+
fmov x8, d0
43+
mov x9, #0x7ff0000000000000
44+
and x8, x8, #0x7fffffffffffffff
45+
cmp x8, x9
46+
b.lt main+0x5c
47+
fcmp d0, #0.0
48+
mov w8, #-0x1
49+
csinc w0, w8, wzr, le
50+
ldr x30, [sp], #0x10
51+
.cfi_def_cfa_offset 0
52+
.cfi_restore x30
53+
54+
ret
55+
nop
56+
.cfi_restore_state
57+
58+
ldr d2, [sp, #0x8]
59+
mov x8, #0x3cb0000000000000
60+
fabs d1, d0
61+
fcmp d0, #0.0
62+
fmov d3, x8
63+
mov w8, #-0x1
64+
csinc w0, w8, wzr, le
65+
fmul d2, d2, d3
66+
fcmp d1, d2
67+
b.ls main+0x28
68+
b main+0x2c
69+
.cfi_endproc

0 commit comments

Comments
 (0)