61 lines · plain
1# REQUIRES: system-linux2 3# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \4# RUN: %s -o %t.o5# RUN: link_fdata %s %t.o %t.fdata6# RUN: link_fdata %s %t.o %t.fdata2 "FDATA2"7# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q8# RUN: llvm-bolt %t.exe --data %t.fdata --reorder-blocks=none \9# RUN: --print-finalized --tail-duplication=cache -o %t.out | FileCheck %s10# RUN: llvm-bolt %t.exe --data %t.fdata2 --reorder-blocks=none \11# RUN: --print-finalized --tail-duplication=cache -o %t.out2 \12# RUN: | FileCheck --check-prefix="CHECK2" %s13 14## A test where the tail is duplicated to eliminate an unconditional jump15# FDATA: 1 main #.BB0_br# 1 main #.BB4# 0 10016# FDATA: 1 main #.BB0_br# 1 main #.BB1# 0 10017# FDATA: 1 main #.BB1_br# 1 main #.BB3# 0 5018# FDATA: 1 main #.BB1_br# 1 main #.BB2# 0 5019# FDATA: 1 main #.BB3_br# 1 main #.BB2# 0 5020# CHECK: BOLT-INFO: tail duplication modified 1 ({{.*}}%) functions; duplicated 1 blocks (13 bytes) responsible for 50 dynamic executions ({{.*}}% of all block executions)21# CHECK: BB Layout : .LBB00, .Ltmp0, .Ltmp1, .Ltmp2, .Ltmp3, .Ltmp4, .Ltmp5, .Ltail-dup0, .Ltmp622 23## A test where the tail is not duplicated due to the cache score24# FDATA2: 1 main #.BB0_br# 1 main #.BB4# 0 10025# FDATA2: 1 main #.BB0_br# 1 main #.BB1# 0 226# FDATA2: 1 main #.BB1_br# 1 main #.BB3# 0 127# FDATA2: 1 main #.BB1_br# 1 main #.BB2# 0 128# FDATA2: 1 main #.BB3_br# 1 main #.BB2# 0 129# CHECK2: BOLT-INFO: tail duplication modified 0 (0.00%) functions; duplicated 0 blocks (0 bytes) responsible for 0 dynamic executions (0.00% of all block executions)30# CHECK2: BB Layout : .LBB00, .Ltmp0, .Ltmp1, .Ltmp2, .Ltmp3, .Ltmp4, .Ltmp5, .Ltmp631 32 .text33 .globl main34 .type main, %function35 .size main, .Lend-main36main:37.BB0:38 xor %eax, %eax39 cmpl %eax, %ebx40.BB0_br:41 je .BB442.BB1:43 inc %rax44.BB1_br:45 je .BB346.BB2:47 inc %rax48 inc %rax49 inc %rax50 inc %rax51 retq52.BB3:53 inc %rax54.BB3_br:55 jmp .BB256.BB4:57 retq58# For relocations against .text59 call exit60.Lend:61