1 /// Test that annotations are properly carried over to fixed calls.
2 /// Note that
--enable-bat is used to force offsets to
be kept.
4 // RUN
: llvm-mc
-triple riscv64
-mattr
=+c
-filetype obj
-o
%t.o
%s
5 // RUN
: ld.lld
--emit-relocs
-o
%t %t.o
6 // RUN
: llvm-bolt
--enable-bat
--print-cfg
--print-fix-riscv-calls \
7 // RUN
: -o
/dev
/null
%t | FileCheck
%s
17 // CHECK-LABEL
: Binary Function
"_start" after building cfg
{
19 // CHECK-NEXT
: jalr ra
, -4(ra
) # Offset: 4
20 // CHECK-NEXT
: jal ra
, f
# Offset: 8
21 // CHECK-NEXT
: jal zero
, f
# TAILCALL # Offset: 12
23 // CHECK-LABEL
: Binary Function
"long_tail" after building cfg
{
25 // CHECK-NEXT
: jalr zero
, -24(t1
) # TAILCALL # Offset: 8
27 // CHECK-LABEL
: Binary Function
"compressed_tail" after building cfg
{
28 // CHECK
: jr a0
# TAILCALL # Offset: 0
30 // CHECK-LABEL
: Binary Function
"_start" after fix-riscv-calls
{
31 // CHECK
: call f
# Offset: 0
32 // CHECK-NEXT
: call f
# Offset: 8
33 // CHECK-NEXT
: tail f
# TAILCALL # Offset: 12
35 // CHECK-LABEL
: Binary Function
"long_tail" after fix-riscv-calls
{
36 // CHECK
: tail f
# TAILCALL # Offset: 4
38 // CHECK-LABEL
: Binary Function
"compressed_tail" after fix-riscv-calls
{
39 // CHECK
: jr a0
# TAILCALL # Offset: 0
47 .size _start, .-_start
52 // NOTE
: BOLT assumes indirect calls in single-BB functions are tail calls
53 // so artificially introduce
a second BB to force RISC-V-specific analysis
58 .size long_tail, .-long_tail
60 .globl compressed_tail
65 .size compressed_tail, .-compressed_tail