1 # This checks that shrink wrapping does not pessimize a CFG pattern where two
2 # blocks can be proved to have the same execution count but, because of profile
3 # inaccuricies, we could move saves into the second block. We can prove two
4 # blocks have the same frequency when B post-dominate A and A dominates B and
5 # are at the same loop nesting level. This would be a pessimization because
6 # shrink wrapping is unlikely to be able to cleanly move PUSH instructions,
7 # inserting additional store instructions.
9 # REQUIRES: system-linux
11 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
13 # RUN: link_fdata %s %t.o %t.fdata
14 # RUN: llvm-strip --strip-unneeded %t.o
15 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib
16 # RUN: llvm-bolt -relocs %t.exe -o %t.out -data %t.fdata \
17 # RUN: -frame-opt=all -equalize-bb-counts | FileCheck %s
19 # Here we create a CFG pattern with two blocks A and B belonging to the same
20 # equivalency class as defined by dominance relations and having in theory
21 # the same frequency. But we tweak edge counts from profile to make block A
22 # hotter than block B.
24 .type _start, %function
28 # FDATA: 0 [unknown] 0 1 _start 0 0 10
35 # FDATA: 1 _start #b# 1 _start #end_if_1# 0 1
37 movq rel
(%rip
), %rdi
# Add this to create a relocation and run bolt w/ relocs
39 # Reduce frequency from 9 to 1 to simulate an inaccurate profile
40 # FDATA: 1 _start #c# 1 _start #end_if_1# 0 1
42 # first uses of R14 and RBX appear at this point, possible move point for SW
45 leaq
-0x20(%rbp
), %r14
46 movq
-0x20(%rbp
), %rdi
53 .size _start, .-_start
58 # CHECK: BOLT-INFO: Shrink wrapping moved 0 spills inserting load/stores and 0 spills inserting push/pops