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