Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / shrinkwrapping-lea.s
blobdb31696ebd6dbd3037b0bf973a432b2f2f54c1c9
1 # This checks that shrink wrapping correctly drops moving push/pops when
2 # there is an LEA instruction.
5 # REQUIRES: system-linux
7 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
8 # RUN: %s -o %t.o
9 # RUN: link_fdata %s %t.o %t.fdata
10 # RUN: llvm-strip --strip-unneeded %t.o
11 # RUN: ld.lld %t.o -o %t.exe -q
12 # RUN: llvm-bolt %t.exe -relocs -o %t.out -data %t.fdata \
13 # RUN: -frame-opt=all -simplify-conditional-tail-calls=false \
14 # RUN: -experimental-shrink-wrapping \
15 # RUN: -eliminate-unreachable=false | FileCheck %s
16 # RUN: llvm-objdump -d %t.out --print-imm-hex | \
17 # RUN: FileCheck --check-prefix CHECK-OBJDUMP %s
19 .globl _start
20 .type _start, %function
21 _start:
22 .cfi_startproc
23 # FDATA: 0 [unknown] 0 1 _start 0 0 1
24 push %rbp
25 mov %rsp, %rbp
26 push %rbx
27 push %r14
28 subq $0x20, %rsp
29 je b
31 addq $0x20, %rsp
32 pop %r14
33 pop %rbx
34 pop %rbp
35 ret
37 je f
38 jmp *JT(,%rdi,8)
40 mov %r14, %rdi
41 mov %rbx, %rdi
42 leaq -0x20(%rbp), %r14
43 movq -0x20(%rbp), %rdi
45 addq $0x20, %rsp
46 pop %r14
47 pop %rbx
48 pop %rbp
49 ret
50 .cfi_endproc
51 .size _start, .-_start
52 .data
53 JT:
54 .quad c
55 .quad d
56 .quad f
59 # CHECK: BOLT-INFO: Shrink wrapping moved 2 spills inserting load/stores and 0 spills inserting push/pops
61 # Checks that offsets of instructions accessing the stack were not changed
62 # CHECK-OBJDUMP: <_start>:
63 # CHECK-OBJDUMP: movq %rbx, %rdi
64 # CHECK-OBJDUMP-NEXT: leaq -0x20(%rbp), %r14
65 # CHECK-OBJDUMP: movq -0x20(%rbp), %rdi