brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 343dd89 Raw
59 lines · plain
1## This checks that shrink wrapping does not pessimize a CFG pattern where two2## blocks can be proved to have the same execution count but, because of profile3## inaccuricies, we could move saves into the second block. We can prove two4## blocks have the same frequency when B post-dominate A and A dominates B and5## are at the same loop nesting level. This would be a pessimization because6## shrink wrapping is unlikely to be able to cleanly move PUSH instructions,7## inserting additional store instructions.8 9# REQUIRES: system-linux10 11# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \12# RUN:   %s -o %t.o13# RUN: link_fdata %s %t.o %t.fdata14# RUN: llvm-strip --strip-unneeded %t.o15# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib16# RUN: llvm-bolt -relocs %t.exe -o %t.out -data %t.fdata \17# RUN:     -frame-opt=all -equalize-bb-counts | FileCheck %s18 19## Here we create a CFG pattern with two blocks A and B belonging to the same20## equivalency class as defined by dominance relations and having in theory21## the same frequency. But we tweak edge counts from profile to make block A22## hotter than block B.23  .globl _start24  .type _start, %function25_start:26  .cfi_startproc27## Hot prologue28# FDATA: 0 [unknown] 0 1 _start 0 0 1029  push  %rbp30  mov   %rsp, %rbp31  push  %rbx32  push  %r1433  subq  $0x20, %rsp34b:  je  end_if_135# FDATA: 1 _start #b# 1 _start #end_if_1# 0 136if_false:37  movq rel(%rip), %rdi  # Add this to create a relocation and run bolt w/ relocs38c:  jmp end_if_139## Reduce frequency from 9 to 1 to simulate an inaccurate profile40# FDATA: 1 _start #c# 1 _start #end_if_1# 0 141end_if_1:42  # first uses of R14 and RBX appear at this point, possible move point for SW43  mov %r14, %rdi44  mov %rbx, %rdi45  leaq -0x20(%rbp), %r1446  movq -0x20(%rbp), %rdi47  addq  $0x20, %rsp48  pop %r1449  pop %rbx50  pop %rbp51  ret52  .cfi_endproc53  .size _start, .-_start54 55  .data56rel:  .quad _start57 58# CHECK:   BOLT-INFO: Shrink wrapping moved 0 spills inserting load/stores and 0 spills inserting push/pops59