1## Test the control of aggressiveness of 3-way splitting by -call-scale. 2## When -call-scale=0.0, the tested function is 2-way splitted. 3## When -call-scale=1.0, the tested function is 3-way splitted with 5 blocks 4## in warm because of the increased benefit of shortening the call edges. 5## When -call-scale=1000.0, the tested function is still 3-way splitted with 6## 5 blocks in warm because cdsplit does not allow hot-warm splitting to break 7## a fall through branch from a basic block to its most likely successor. 8 9# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o 10# RUN: link_fdata %s %t.o %t.fdata 11# RUN: llvm-strip --strip-unneeded %t.o 12# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q 13# RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-strategy=cdsplit \ 14# RUN: --call-scale=0.0 --print-split --print-only=chain \ 15# RUN: --data=%t.fdata --reorder-blocks=ext-tsp \ 16# RUN: 2>&1 | FileCheck --check-prefix=LOWINCENTIVE %s 17# RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-strategy=cdsplit \ 18# RUN: --call-scale=1.0 --print-split --print-only=chain \ 19# RUN: --data=%t.fdata --reorder-blocks=ext-tsp \ 20# RUN: 2>&1 | FileCheck --check-prefix=MEDINCENTIVE %s 21# RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --split-strategy=cdsplit \ 22# RUN: --call-scale=1000.0 --print-split --print-only=chain \ 23# RUN: --data=%t.fdata --reorder-blocks=ext-tsp \ 24# RUN: 2>&1 | FileCheck --check-prefix=HIGHINCENTIVE %s 25 26# LOWINCENTIVE: Binary Function "chain" after split-functions 27# LOWINCENTIVE: {{^\.Ltmp5}} 28# LOWINCENTIVE: ------- HOT-COLD SPLIT POINT ------- 29# LOWINCENTIVE: {{^\.LFT1}} 30 31# MEDINCENTIVE: Binary Function "chain" after split-functions 32# MEDINCENTIVE: {{^\.Ltmp1}} 33# MEDINCENTIVE: ------- HOT-COLD SPLIT POINT ------- 34# MEDINCENTIVE: {{^\.LFT1}} 35# MEDINCENTIVE: ------- HOT-COLD SPLIT POINT ------- 36# MEDINCENTIVE: {{^\.Ltmp0}} 37# MEDINCENTIVE: {{^\.Ltmp2}} 38# MEDINCENTIVE: {{^\.Ltmp3}} 39# MEDINCENTIVE: {{^\.Ltmp4}} 40# MEDINCENTIVE: {{^\.Ltmp5}} 41 42# HIGHINCENTIVE: Binary Function "chain" after split-functions 43# HIGHINCENTIVE: {{^\.Ltmp1}} 44# HIGHINCENTIVE: ------- HOT-COLD SPLIT POINT ------- 45# HIGHINCENTIVE: {{^\.LFT1}} 46# HIGHINCENTIVE: ------- HOT-COLD SPLIT POINT ------- 47# HIGHINCENTIVE: {{^\.Ltmp0}} 48# HIGHINCENTIVE: {{^\.Ltmp2}} 49# HIGHINCENTIVE: {{^\.Ltmp3}} 50# HIGHINCENTIVE: {{^\.Ltmp4}} 51# HIGHINCENTIVE: {{^\.Ltmp5}} 52 53 54 55 .text 56 .globl chain 57 .type chain, @function 58chain: 59 pushq %rbp 60 movq %rsp, %rbp 61 cmpl $2, %edi 62LLentry_LLchain_start: 63 jge LLchain_start 64# FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLchain_start# 0 10 65# FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLfast# 0 500 66LLfast: 67 movl $5, %eax 68LLfast_LLexit: 69 jmp LLexit 70# FDATA: 1 chain #LLfast_LLexit# 1 chain #LLexit# 0 500 71LLchain_start: 72 movl $10, %eax 73LLchain_start_LLchain1: 74 jge LLchain1 75# FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLchain1# 0 10 76# FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLcold# 0 0 77LLcold: 78 addl $1, %eax 79 addl $1, %eax 80 addl $1, %eax 81 addl $1, %eax 82 addl $1, %eax 83 addl $1, %eax 84LLchain1: 85 addl $1, %eax 86LLchain1_LLchain2: 87 jmp LLchain2 88# FDATA: 1 chain #LLchain1_LLchain2# 1 chain #LLchain2# 0 10 89LLchain2: 90 addl $1, %eax 91LLchain2_LLchain3: 92 jmp LLchain3 93# FDATA: 1 chain #LLchain2_LLchain3# 1 chain #LLchain3# 0 10 94LLchain3: 95 addl $1, %eax 96 addl $1, %eax 97 addl $1, %eax 98 addl $1, %eax 99 addl $1, %eax 100LLchain3_LLchain4: 101 jmp LLchain4 102# FDATA: 1 chain #LLchain3_LLchain4# 1 chain #LLchain4# 0 10 103LLchain4: 104 addl $1, %eax 105 addl $1, %eax 106 addl $1, %eax 107 addl $1, %eax 108 addl $1, %eax 109LLchain4_LLexit: 110 jmp LLexit 111# FDATA: 1 chain #LLchain4_LLexit# 1 chain #LLexit# 0 10 112LLexit: 113 popq %rbp 114 ret 115LLchain_end: 116 .size chain, LLchain_end-chain 117 118 119 .globl main 120 .type main, @function 121main: 122 pushq %rbp 123 movq %rsp, %rbp 124 movl $1, %edi 125LLmain_chain1: 126 call chain 127# FDATA: 1 main #LLmain_chain1# 1 chain 0 0 500 128 movl $4, %edi 129LLmain_chain2: 130 call chain 131# FDATA: 1 main #LLmain_chain2# 1 chain 0 0 10 132 xorl %eax, %eax 133 popq %rbp 134 retq 135.Lmain_end: 136 .size main, .Lmain_end-main 137