Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / frame-opt-lea.s
blobfe84e8c03744742c27df1876ae0ff72803e3b25f
1 # This checks that frame optimizer does not try to optimize away caller-saved
2 # regs when we do not have complete aliasing info (when there is an LEA
3 # instruction and the function does arithmetic with stack addresses).
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: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
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: -lite=0 -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 foo
20 .type foo, %function
21 foo:
22 .cfi_startproc
23 movq $0, (%rsi)
24 ret
25 .cfi_endproc
26 .size foo, .-foo
29 .globl _start
30 .type _start, %function
31 _start:
32 .cfi_startproc
33 # FDATA: 0 [unknown] 0 1 _start 0 0 1
34 push %rbp
35 mov %rsp, %rbp
36 subq $0x20, %rsp
37 je b
39 addq $0x20, %rsp
40 pop %rbp
41 ret
43 movq %rdi, %r13
44 movq %r13, -0x08(%rbp)
45 leaq -0x08(%rbp), %rsi
46 callq foo
47 movq -0x08(%rbp), %r13
48 jmp c
49 .cfi_endproc
50 .size _start, .-_start
53 # CHECK: BOLT-INFO: FOP deleted 0 load(s) (dyn count: 0) and 0 store(s)
55 # CHECK-OBJDUMP: <_start>:
56 # CHECK-OBJDUMP: movq %rdi, %r13
57 # CHECK-OBJDUMP-NEXT: movq %r13, -0x8(%rbp)
58 # CHECK-OBJDUMP-NEXT: leaq
59 # CHECK-OBJDUMP-NEXT: callq
60 # CHECK-OBJDUMP-NEXT: movq -0x8(%rbp), %r13