117 lines · plain
1RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown \2RUN: %p/Inputs/jump_table_icp.s -o %t.o3RUN: link_fdata %p/Inputs/jump_table_icp.s %t.o %t.fdata --nmtool llvm-nm4RUN: llvm-strip --strip-unneeded %t.o5RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q6 7RUN: llvm-bolt %t.exe --data %t.fdata -o %t --relocs \8RUN: --reorder-blocks=cache --split-functions --split-all-cold \9RUN: --use-gnu-stack --dyno-stats --indirect-call-promotion=jump-tables \10RUN: --print-icp -v=0 \11RUN: --enable-bat --print-cache-metrics \12RUN: --icp-jt-remaining-percent-threshold=10 \13RUN: --icp-jt-total-percent-threshold=2 \14RUN: --indirect-call-promotion-topn=1 \15RUN: --icp-jump-tables-targets --align-functions-max-bytes=7 | FileCheck %s16RUN: llvm-objdump -d %t --print-imm-hex | FileCheck --check-prefix CHECK-ASM %s17 18BOLT-INFO: ICP total indirect callsites = 019BOLT-INFO: ICP total jump table callsites = 220BOLT-INFO: ICP total number of calls = 213721BOLT-INFO: ICP percentage of calls that are indirect = 0.0%22BOLT-INFO: ICP percentage of indirect calls that can be optimized = 0.0%23BOLT-INFO: ICP percentage of indirect calls that are optimized = 0.0%24BOLT-INFO: ICP percentage of jump table calls that can be optimized = 17.7%25BOLT-INFO: ICP percentage of jump table calls that are optimized = 100.0%26 27CHECK: Binary Function "_Z3inci" after indirect-call-promotion28CHECK: .LBB{{.*}} (8 instructions, align : 1)29CHECK-NEXT: Entry Point30CHECK-NEXT: Exec Count : 107331CHECK: Successors: .Ltmp{{.*}} (mispreds: 189, count: 189), .LFT{{.*}} (mispreds: 0, count: 881)32 33CHECK: .LFT{{.*}} (4 instructions, align : 1)34CHECK-NEXT: Exec Count : 88135CHECK: Predecessors: .LBB{{.*}}36CHECK: je {{.*}} # Offset: 2837CHECK-NEXT: Successors: .Ltmp{{.*}} (mispreds: 138, count: 155), .Ltmp{{.*}} (mispreds: 0, count: 726)38 39CHECK: .Ltmp{{.*}} (1 instructions, align : 1)40CHECK-NEXT: Exec Count : 72641CHECK: Predecessors: .LFT{{.*}}42CHECK: jmpq {{.*}} # Offset: 2843CHECK-NEXT: Successors: .L{{.*}} (mispreds: 126, count: 157), .L{{.*}} (mispreds: 140, count: 156), .L{{.*}} (mispreds: 134, count: 152), .L{{.*}} (mispreds: 137, count: 150), .L{{.*}} (mispreds: 129, count: 148), .L{{.*}} (mispreds: 0, count: 0)44 45CHECK: .Ltmp{{.*}} (5 instructions, align : 1)46CHECK-NEXT: Exec Count : 16747CHECK: Predecessors: .Ltmp{{.*}}, .LFT{{.*}}48 49CHECK: .Ltmp{{.*}} (5 instructions, align : 1)50CHECK-NEXT: Exec Count : 15651CHECK: Predecessors: .Ltmp{{.*}}52 53CHECK: .Ltmp{{.*}} (5 instructions, align : 1)54CHECK-NEXT: Exec Count : 15755CHECK: Predecessors: .Ltmp{{.*}}56 57CHECK: .Ltmp{{.*}} (5 instructions, align : 1)58CHECK-NEXT: Exec Count : 14859CHECK: Predecessors: .Ltmp{{.*}}60 61CHECK: .Ltmp{{.*}} (5 instructions, align : 1)62CHECK-NEXT: Exec Count : 15063CHECK: Predecessors: .Ltmp{{.*}}64 65CHECK: Binary Function "_Z7inc_dupi" after indirect-call-promotion66CHECK: .LBB{{.*}} (8 instructions, align : 1)67CHECK-NEXT: Entry Point68CHECK-NEXT: Exec Count : 106469CHECK: Successors: .Ltmp{{.*}} (mispreds: 143, count: 144), .LFT{{.*}} (mispreds: 0, count: 777)70 71CHECK: .LFT{{.*}} (4 instructions, align : 1)72CHECK-NEXT: Exec Count : 77773CHECK: Predecessors: .LBB{{.*}}74CHECK: Successors: .Ltmp{{.*}} (mispreds: 120, count: 138), .Ltmp{{.*}} (mispreds: 0, count: 639)75 76CHECK: .Ltmp{{.*}} (1 instructions, align : 1)77CHECK-NEXT: Exec Count : 63978CHECK: Predecessors: .LFT{{.*}}79CHECK: Successors: .L{{.*}} (mispreds: 130, count: 137), .L{{.*}} (mispreds: 126, count: 136), .L{{.*}} (mispreds: 122, count: 130), .L{{.*}} (mispreds: 111, count: 130), .L{{.*}} (mispreds: 104, count: 114), .L{{.*}} (mispreds: 0, count: 0)80 81CHECK: .Ltmp{{.*}} (5 instructions, align : 1)82CHECK-NEXT: Exec Count : 13783CHECK: Predecessors: .Ltmp{{.*}}84CHECK: Successors: .Ltmp{{.*}} (mispreds: 0, count: 106)85 86CHECK: .Ltmp{{.*}} (5 instructions, align : 1)87CHECK-NEXT: Exec Count : 13688CHECK: Predecessors: .Ltmp{{.*}}89CHECK: Successors: .Ltmp{{.*}} (mispreds: 0, count: 113)90 91CHECK: .Ltmp{{.*}} (5 instructions, align : 1)92CHECK-NEXT: Exec Count : 13093CHECK: Predecessors: .Ltmp{{.*}}94CHECK: Successors: .Ltmp{{.*}} (mispreds: 0, count: 97)95 96CHECK: .Ltmp{{.*}} (5 instructions, align : 1)97CHECK-NEXT: Exec Count : 13098CHECK: Predecessors: .Ltmp{{.*}}99CHECK: Successors: .Ltmp{{.*}} (mispreds: 0, count: 105)100 101CHECK: .Ltmp{{.*}} (5 instructions, align : 1)102CHECK-NEXT: Exec Count : 140103CHECK: Predecessors: .Ltmp{{.*}}, .LFT{{.*}}104CHECK: Successors: .Ltmp{{.*}} (mispreds: 0, count: 98)105 106CHECK-ASM: <_Z3inci>:107CHECK-ASM: movq 0x{{.*}}(,%rax,8), %rax108CHECK-ASM-NEXT: cmpq $0x{{.*}}, %rax109CHECK-ASM-NEXT: je {{.*}} <_Z3inci+0x{{.*}}>110CHECK-ASM-NEXT: jmpq *%rax111 112CHECK-ASM: <_Z7inc_dupi>:113CHECK-ASM: movq 0x{{.*}}(,%rax,8), %rax114CHECK-ASM-NEXT: cmpq $0x{{.*}}, %rax115CHECK-ASM-NEXT: je {{.*}} <_Z7inc_dupi+0x{{.*}}>116CHECK-ASM-NEXT: jmpq *%rax117