Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / shrinkwrapping-mov.s
blob4a81b369c9766a6a6053077c8172886340133a2f
1 # This checks that shrink wrapping correctly drops moving push/pops when
2 # there is a MOV instruction loading the value of the stack pointer in
3 # order to do pointer arithmetic with a stack address.
6 # REQUIRES: system-linux
8 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
9 # RUN: %s -o %t.o
10 # RUN: link_fdata %s %t.o %t.fdata
11 # RUN: llvm-strip --strip-unneeded %t.o
12 # RUN: ld.lld %t.o -o %t.exe -q
13 # RUN: llvm-bolt %t.exe -relocs -o %t.out -data %t.fdata \
14 # RUN: -frame-opt=all -simplify-conditional-tail-calls=false \
15 # RUN: -experimental-shrink-wrapping \
16 # RUN: -eliminate-unreachable=false | FileCheck %s
18 .globl _start
19 .type _start, %function
20 _start:
21 .cfi_startproc
22 # FDATA: 0 [unknown] 0 1 _start 0 0 1
23 push %rbp
24 mov %rsp, %rbp
25 push %rbx
26 push %r14
27 subq $0x20, %rsp
28 je b
30 addq $0x20, %rsp
31 pop %r14
32 pop %rbx
33 pop %rbp
34 ret
36 je f
37 jmp *JT(,%rdi,8)
39 mov %r14, %rdi
40 mov %rbx, %rdi
41 mov %rbp, %rdi
42 sub 0x20, %rdi
44 addq $0x20, %rsp
45 pop %r14
46 pop %rbx
47 pop %rbp
48 ret
49 .cfi_endproc
50 .size _start, .-_start
51 .data
52 JT:
53 .quad c
54 .quad d
55 .quad f
58 # CHECK: BOLT-INFO: Shrink wrapping moved 2 spills inserting load/stores and 0 spills inserting push/pops