1## This checks that shrink wrapping correctly drops moving push/pops when 2## there is an LEA instruction. 3 4 5# REQUIRES: system-linux 6 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 18 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 30c: 31 addq $0x20, %rsp 32 pop %r14 33 pop %rbx 34 pop %rbp 35 ret 36b: 37 je f 38 jmp *JT(,%rdi,8) 39d: 40 mov %r14, %rdi 41 mov %rbx, %rdi 42 leaq -0x20(%rbp), %r14 43 movq -0x20(%rbp), %rdi 44f: 45 addq $0x20, %rsp 46 pop %r14 47 pop %rbx 48 pop %rbp 49 ret 50 .cfi_endproc 51 .size _start, .-_start 52 .data 53JT: 54 .quad c 55 .quad d 56 .quad f 57 58 59# CHECK: BOLT-INFO: Shrink wrapping moved 2 spills inserting load/stores and 0 spills inserting push/pops 60 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 66