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: %clang %cflags %t.o -o %t.exe -Wl,-q7 8# RUN: llvm-bolt %t.exe --data %t.fdata --print-finalized \9# RUN: --tail-duplication=moderate --tail-duplication-minimum-offset=1 \10# RUN: -o %t.out | FileCheck %s11 12# FDATA: 1 main f 1 main 19 0 1013# FDATA: 1 main f 1 main 11 0 1314# FDATA: 1 main 17 1 main 3c 0 1015# FDATA: 1 main 39 1 main 3c 0 1016 17# CHECK: tail duplication modified 1 ({{.*}}%) functions; duplicated 1 blocks ({{.*}} bytes) responsible for {{.*}} dynamic executions ({{.*}} of all block executions)18# CHECK: BB Layout : .LBB00, .Ltmp0, .Ltail-dup0, .Ltmp1, .Ltmp219 20## This is the C++ code fed to Clang21## int fib(int term) {22## if (term <= 1)23## return term;24## return fib(term-1) + fib(term-2);25## }26 27 .text28 .globl main29 .type main, %function30 .size main, .Lend-main31main:32 push %rbp33 mov %rsp,%rbp34 sub $0x10,%rsp35 mov %edi,-0x8(%rbp)36 cmpl $0x1,-0x8(%rbp)37 jg .BB138.BB0:39 mov -0x8(%rbp),%eax40 mov %eax,-0x4(%rbp)41 jmp .BB242.BB1:43 mov -0x8(%rbp),%edi44 sub $0x1,%edi45 call main46 mov %eax,-0xc(%rbp)47 mov -0x8(%rbp),%edi48 sub $0x2,%edi49 call main50 mov %eax,%ecx51 mov -0xc(%rbp),%eax52 add %ecx,%eax53 mov %eax,-0x4(%rbp)54.BB2:55 mov -0x4(%rbp),%eax56 add $0x10,%rsp57 pop %rbp58 retq59 nopl 0x0(%rax)60.Lend:61