Skip to content

Commit bc31f66

Browse files
author
Ash Dobrescu
committed
Address review comments
1 parent 62b7cac commit bc31f66

File tree

2 files changed

+20
-52
lines changed

2 files changed

+20
-52
lines changed

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,6 +1663,9 @@ class BinaryFunction {
16631663
Offset = I->first;
16641664
}
16651665
assert(I->first == Offset && "CFI pointing to unknown instruction");
1666+
// When dealing with RememberState, we place this CFI in FrameInstructions.
1667+
// We want to ensure RememberState and RestoreState CFIs are in the same
1668+
// list in order to properly populate the StateStack.
16661669
if (I == Instructions.begin() &&
16671670
Inst.getOperation() != MCCFIInstruction::OpRememberState) {
16681671
CIEFrameInstructions.emplace_back(std::forward<MCCFIInstruction>(Inst));

bolt/test/AArch64/cfi-state-list.test

Lines changed: 17 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
66
# RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
77

8-
# CHECK: BOLT-INFO: Target architecture: aarch64
9-
# CHECK: BOLT-INFO: enabling relocation mode
10-
# CHECK-NOT: llvm-bolt:
118
# CHECK: BOLT-INFO: Starting stub-insertion pass
129

1310
.text
@@ -16,54 +13,22 @@
1613

1714
main:
1815
.cfi_startproc
19-
.cfi_def_cfa_offset 16
20-
.cfi_offset x30, -8
2116
.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
17+
mov w0, wzr
18+
b.ne .L1
19+
.L0:
20+
mov w0, wzr
21+
.L1:
22+
cmp x0, #0
23+
b.lt .L2
24+
.L2:
25+
nop
26+
.cfi_restore_state
27+
mov x8, xzr
28+
b.ls .L0
29+
ret
6930
.cfi_endproc
31+
.size main, .-main
32+
33+
## Force relocation mode.
34+
.reloc 0, R_AARCH64_NONE

0 commit comments

Comments
 (0)