brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · cbc2953 Raw
56 lines · plain
1## This checks that shrink wrapping does attempt at accessing stack elements2## using RSP when the function is aligning RSP and changing offsets.3 4# REQUIRES: system-linux5 6# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \7# RUN:   %s -o %t.o8# RUN: link_fdata %s %t.o %t.fdata9# RUN: llvm-strip --strip-unneeded %t.o10# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib11# RUN: llvm-bolt %t.exe -o %t.out --data %t.fdata \12# RUN:     --frame-opt=all --simplify-conditional-tail-calls=false \13# RUN:     --eliminate-unreachable=false | FileCheck %s14 15## Here we have a function that aligns the stack at prologue. Stack pointer16## analysis can't try to infer offset positions after AND because that depends17## on the runtime value of the stack pointer of callee (whether it is misaligned18## or not).19  .globl _start20  .type _start, %function21_start:22  .cfi_startproc23# FDATA: 0 [unknown] 0 1 _start 0 0 124  push  %rbp25  mov   %rsp, %rbp26  push  %rbx27  push  %r1428  and    $0xffffffffffffffe0,%rsp29  subq  $0x20, %rsp30b:  je  hot_path31# FDATA: 1 _start #b# 1 _start #hot_path# 0 132cold_path:33  mov %r14, %rdi34  mov %rbx, %rdi35  # Block push-pop mode by using an instruction that requires the36  # stack to be aligned to 128B. This will force the pass37  # to try to index stack elements by using RSP +offset directly, but38  # we do not know how to access individual elements of the stack thanks39  # to the alignment.40  movdqa	%xmm8, (%rsp)41  addq  $0x20, %rsp42  pop %r1443  pop %rbx44  pop %rbp45  ret46hot_path:47  addq  $0x20, %rsp48  pop %r1449  pop %rbx50  pop %rbp51  ret52  .cfi_endproc53  .size _start, .-_start54 55# CHECK:   BOLT-INFO: Shrink wrapping moved 0 spills inserting load/stores and 0 spills inserting push/pops56