brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · abad44e Raw
48 lines · plain
1## This test reproduces a POP reordering issue in shrink wrapping where we would2## incorrectly put a store after a load (instead of before) when having multiple3## insertions at the same point. Check that the order is correct in this test.4 5# REQUIRES: system-linux6 7# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %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 --frame-opt=all --lite=0 \12# RUN:           --print-fop 2>&1 | FileCheck %s13 14  .globl _start15_start:16    .cfi_startproc17# FDATA: 0 [unknown] 0 1 _start 0 0 618    je a19b:  jne _start20# FDATA: 1 _start #b# 1 _start #c# 0 321 22c:23  push  %rbx24  push  %rbp25  pop   %rbp26  pop   %rbx27 28## This basic block is treated as having 0 execution count.29## push and pop will be sinked into this block.30a:31    ud232    .cfi_endproc33 34 35## Check shrink wrapping results:36# CHECK: BOLT-INFO: Shrink wrapping moved 0 spills inserting load/stores and 2 spills inserting push/pops37# CHECK: BOLT-INFO: Shrink wrapping reduced 6 store executions (28.6% total instructions executed, 100.0% store instructions)38# CHECK: BOLT-INFO: Shrink wrapping failed at reducing 0 store executions (0.0% total instructions executed, 0.0% store instructions)39 40## Check that order is correct41# CHECK:      Binary Function "_start" after frame-optimizer42# Pushes are ordered according to their reg number and come first43# CHECK:      pushq   %rbp44# CHECK:      pushq   %rbx45## Pops are ordered according to their dominance relation and come last46# CHECK:      popq    %rbx47# CHECK:      popq    %rbp48