Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / RISCV / relax.s
blob01682e4405b71598512a2ba6322b6cb6205832d4
1 // RUN: llvm-mc -triple riscv64 -mattr=+c,+relax -filetype obj -o %t.o %s
2 // RUN: ld.lld --emit-relocs -o %t %t.o
3 // RUN: llvm-bolt --print-cfg --print-fix-riscv-calls --print-only=_start \
4 // RUN: -o %t.bolt %t | FileCheck %s
5 // RUN: llvm-objdump -d %t.bolt | FileCheck --check-prefix=OBJDUMP %s
7 // CHECK: Binary Function "_start" after building cfg {
8 // CHECK: jal ra, near_f
9 // CHECK-NEXT: auipc ra, far_f@plt
10 // CHECK-NEXT: jalr ra, 12(ra)
11 // CHECK-NEXT: j near_f
13 // CHECK: Binary Function "_start" after fix-riscv-calls {
14 // CHECK: call near_f
15 // CHECK-NEXT: call far_f
16 // CHECK-NEXT: tail near_f
18 // OBJDUMP: 0000000000600000 <_start>:
19 // OBJDUMP-NEXT: jal 0x600040 <near_f>
20 // OBJDUMP-NEXT: auipc ra, 512
21 // OBJDUMP-NEXT: jalr 124(ra)
22 // OBJDUMP-NEXT: j 0x600040 <near_f>
23 // OBJDUMP: 0000000000600040 <near_f>:
24 // OBJDUMP: 0000000000800080 <far_f>:
26 .text
27 .globl _start
28 .p2align 1
29 _start:
30 call near_f
31 call far_f
32 tail near_f
33 .size _start, .-_start
35 .global near_f
36 .p2align 1
37 near_f:
38 ret
39 .size near_f, .-near_f
41 .skip (1 << 21)
43 .global far_f
44 .p2align 1
45 far_f:
46 ret
47 .size far_f, .-far_f