xref: /llvm-project/bolt/test/runtime/X86/tail-duplication-constant-prop.s (revision d648aa1b8e937de1648524e1f1016b53b29ba2a4)
1# REQUIRES: system-linux
2
3# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \
4# RUN:   %s -o %t.o
5# RUN: link_fdata %s %t.o %t.fdata
6# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
7# RUN: llvm-bolt %t.exe --data %t.fdata --reorder-blocks=ext-tsp \
8# RUN:    --print-finalized \
9# RUN:    --tail-duplication=moderate --tail-duplication-minimum-offset=1 \
10# RUN:    --tail-duplication-const-copy-propagation=1 -o %t.out | FileCheck %s
11# RUN: %t.exe; echo $?
12# RUN: %t.out; echo $?
13
14# FDATA: 1 main 14 1 main #.BB2# 0 10
15# FDATA: 1 main 16 1 main #.BB2# 0 20
16# CHECK: BOLT-INFO: tail duplication modified 1 ({{.*}}%) functions; duplicated 1 blocks ({{.*}} bytes) responsible for {{.*}} dynamic executions ({{.*}}% of all block executions)
17# CHECK: BB Layout   : .LBB00, .Ltail-dup0, .Ltmp0, .Ltmp1
18# CHECK-NOT: mov $0x2, %rbx
19
20    .text
21    .globl main
22    .type main, %function
23    .size main, .Lend-main
24main:
25    mov $0x2, %rbx
26    mov $0x1, %rdi
27    inc %rdi
28    mov %rdi, %rsi
29    jmp .BB2
30.BB1:
31    mov $0x9, %rbx
32.BB2:
33    mov %rbx, %rax
34    mov $0x5, %rbx
35    add %rsi, %rax
36    retq
37.BB3:
38    mov $0x9, %rbx
39.BB4:
40    mov $0xa, %rsi
41    add %rbx, %rax
42    add %rsi, %rax
43.BB5:
44    retq
45.Lend:
46