1 # This reproduces a bug with shrink wrapping when trying to move
2 # push-pops in a function where we are not allowed to modify the
3 # stack layout for alignment reasons. In this bug, we failed to
4 # propagate alignment requirement upwards in the call graph for
5 # some functions when there is a cycle in the call graph.
7 # REQUIRES: system-linux
9 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
11 # RUN: link_fdata %s %t.o %t.fdata
12 # Delete our BB symbols so BOLT doesn't mark them as entry points
13 # RUN: llvm-strip --strip-unneeded %t.o
14 # RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q
16 # RUN: llvm-bolt %t.exe --relocs=1 --frame-opt=all --print-finalized \
17 # RUN: --lite=0 --print-only=main --data %t.fdata -o %t.out | FileCheck %s
21 # CHECK: BOLT-INFO: Shrink wrapping moved 1 spills inserting load/stores and 0 spills inserting push/pops
28 # FDATA: 0 [unknown] 0 1 bar 0 0 510
31 pushq
%rbx
# We save rbx here, but there is an
32 # opportunity to move it to .BB2
37 # FDATA: 1 bar #.J1# 1 bar #.BB2# 0 10
38 # FDATA: 1 bar #.J1# 1 bar #.BBend# 0 500
40 movq $
2, %rbx
# Use rbx in a cold block
56 # This is a path that is never executed, but we add a call to main here
57 # to force a cycle in the call graph and to require us to have an aligned
65 # Frame alignedness information needs to be transmitted from foo to main to bar
70 # Call a function that requires an aligned stack
72 # Call a function that can be shrink-wrapped
77 # Frame alignedness information needs to be transmitted from foo to main to bar
82 # Use an instruction that requires an aligned stack
83 movdqa
-0x10(%rsp
), %xmm0
88 mystring
: .asciz "0 is rbx mod 10 contents in decimal\n"