137 lines · plain
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 split.3## When -call-scale=1.0, the tested function is 3-way split with 5 blocks4## 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 split with6## 5 blocks in warm because cdsplit does not allow hot-warm splitting to break7## 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.o10# RUN: link_fdata %s %t.o %t.fdata11# RUN: llvm-strip --strip-unneeded %t.o12# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q13# 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 %s17# 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 %s21# 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 %s25 26# LOWINCENTIVE: Binary Function "chain" after split-functions27# LOWINCENTIVE: {{^\.Ltmp5}}28# LOWINCENTIVE: ------- HOT-COLD SPLIT POINT -------29# LOWINCENTIVE: {{^\.LFT1}}30 31# MEDINCENTIVE: Binary Function "chain" after split-functions32# 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-functions43# 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 .text56 .globl chain57 .type chain, @function58chain:59 pushq %rbp60 movq %rsp, %rbp61 cmpl $2, %edi62LLentry_LLchain_start:63 jge LLchain_start64# FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLchain_start# 0 1065# FDATA: 1 chain #LLentry_LLchain_start# 1 chain #LLfast# 0 50066LLfast:67 movl $5, %eax68LLfast_LLexit:69 jmp LLexit70# FDATA: 1 chain #LLfast_LLexit# 1 chain #LLexit# 0 50071LLchain_start:72 movl $10, %eax73LLchain_start_LLchain1:74 jge LLchain175# FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLchain1# 0 1076# FDATA: 1 chain #LLchain_start_LLchain1# 1 chain #LLcold# 0 077LLcold:78 addl $1, %eax79 addl $1, %eax80 addl $1, %eax81 addl $1, %eax82 addl $1, %eax83 addl $1, %eax84LLchain1:85 addl $1, %eax86LLchain1_LLchain2:87 jmp LLchain288# FDATA: 1 chain #LLchain1_LLchain2# 1 chain #LLchain2# 0 1089LLchain2:90 addl $1, %eax91LLchain2_LLchain3:92 jmp LLchain393# FDATA: 1 chain #LLchain2_LLchain3# 1 chain #LLchain3# 0 1094LLchain3:95 addl $1, %eax96 addl $1, %eax97 addl $1, %eax98 addl $1, %eax99 addl $1, %eax100LLchain3_LLchain4:101 jmp LLchain4102# FDATA: 1 chain #LLchain3_LLchain4# 1 chain #LLchain4# 0 10103LLchain4:104 addl $1, %eax105 addl $1, %eax106 addl $1, %eax107 addl $1, %eax108 addl $1, %eax109LLchain4_LLexit:110 jmp LLexit111# FDATA: 1 chain #LLchain4_LLexit# 1 chain #LLexit# 0 10112LLexit:113 popq %rbp114 ret115LLchain_end:116 .size chain, LLchain_end-chain117 118 119 .globl main120 .type main, @function121main:122 pushq %rbp123 movq %rsp, %rbp124 movl $1, %edi125LLmain_chain1:126 call chain127# FDATA: 1 main #LLmain_chain1# 1 chain 0 0 500128 movl $4, %edi129LLmain_chain2:130 call chain131# FDATA: 1 main #LLmain_chain2# 1 chain 0 0 10132 xorl %eax, %eax133 popq %rbp134 retq135.Lmain_end:136 .size main, .Lmain_end-main137