1 # REQUIRES: system-linux
3 # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
5 # RUN: link_fdata %s %t.o %t.fdata
6 # RUN: link_fdata %s %t.o %t.fdata2 "FDATA2"
7 # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
8 # RUN: llvm-bolt %t.exe --data %t.fdata --reorder-blocks=none \
9 # RUN: --print-finalized --tail-duplication=cache -o %t.out | FileCheck %s
10 # 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" %s
14 # A test where the tail is duplicated to eliminate an unconditional jump
15 # FDATA: 1 main #.BB0_br# 1 main #.BB4# 0 100
16 # FDATA: 1 main #.BB0_br# 1 main #.BB1# 0 100
17 # FDATA: 1 main #.BB1_br# 1 main #.BB3# 0 50
18 # FDATA: 1 main #.BB1_br# 1 main #.BB2# 0 50
19 # FDATA: 1 main #.BB3_br# 1 main #.BB2# 0 50
20 # 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, .Ltmp6
23 # A test where the tail is not duplicated due to the cache score
24 # FDATA2: 1 main #.BB0_br# 1 main #.BB4# 0 100
25 # FDATA2: 1 main #.BB0_br# 1 main #.BB1# 0 2
26 # FDATA2: 1 main #.BB1_br# 1 main #.BB3# 0 1
27 # FDATA2: 1 main #.BB1_br# 1 main #.BB2# 0 1
28 # FDATA2: 1 main #.BB3_br# 1 main #.BB2# 0 1
29 # 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, .Ltmp6
35 .size main, .Lend-main
58 # For relocations against .text