1; RUN: opt -passes=wholeprogramdevirt -whole-program-visibility -wholeprogramdevirt-summary-action=export -wholeprogramdevirt-read-summary=%S/Inputs/export.yaml -wholeprogramdevirt-write-summary=%t -wholeprogramdevirt-branch-funnel-threshold=1 -S -o - %s | not grep @llvm.icall.branch.funnel | count 0 2 3; RUN: opt -passes=wholeprogramdevirt -whole-program-visibility -wholeprogramdevirt-summary-action=export -wholeprogramdevirt-read-summary=%S/Inputs/export.yaml -wholeprogramdevirt-write-summary=%t -wholeprogramdevirt-branch-funnel-threshold=10 -S -o - %s | grep @llvm.icall.branch.funnel | count 4 4 5; RUN: opt -passes=wholeprogramdevirt -whole-program-visibility -wholeprogramdevirt-summary-action=export -wholeprogramdevirt-read-summary=%S/Inputs/export.yaml -wholeprogramdevirt-write-summary=%t -wholeprogramdevirt-branch-funnel-threshold=100 -S -o - %s | grep @llvm.icall.branch.funnel | count 5 6 7target datalayout = "e-p:64:64" 8target triple = "x86_64-unknown-linux-gnu" 9 10@vt1_1 = constant [1 x ptr] [ptr @vf1_1], !type !0 11@vt1_2 = constant [1 x ptr] [ptr @vf1_2], !type !0 12 13declare i32 @vf1_1(ptr %this, i32 %arg) 14declare i32 @vf1_2(ptr %this, i32 %arg) 15 16@vt2_1 = constant [1 x ptr] [ptr @vf2_1], !type !1 17@vt2_2 = constant [1 x ptr] [ptr @vf2_2], !type !1 18@vt2_3 = constant [1 x ptr] [ptr @vf2_3], !type !1 19@vt2_4 = constant [1 x ptr] [ptr @vf2_4], !type !1 20@vt2_5 = constant [1 x ptr] [ptr @vf2_5], !type !1 21@vt2_6 = constant [1 x ptr] [ptr @vf2_6], !type !1 22@vt2_7 = constant [1 x ptr] [ptr @vf2_7], !type !1 23@vt2_8 = constant [1 x ptr] [ptr @vf2_8], !type !1 24@vt2_9 = constant [1 x ptr] [ptr @vf2_9], !type !1 25@vt2_10 = constant [1 x ptr] [ptr @vf2_10], !type !1 26@vt2_11 = constant [1 x ptr] [ptr @vf2_11], !type !1 27 28declare i32 @vf2_1(ptr %this, i32 %arg) 29declare i32 @vf2_2(ptr %this, i32 %arg) 30declare i32 @vf2_3(ptr %this, i32 %arg) 31declare i32 @vf2_4(ptr %this, i32 %arg) 32declare i32 @vf2_5(ptr %this, i32 %arg) 33declare i32 @vf2_6(ptr %this, i32 %arg) 34declare i32 @vf2_7(ptr %this, i32 %arg) 35declare i32 @vf2_8(ptr %this, i32 %arg) 36declare i32 @vf2_9(ptr %this, i32 %arg) 37declare i32 @vf2_10(ptr %this, i32 %arg) 38declare i32 @vf2_11(ptr %this, i32 %arg) 39 40@vt3_1 = constant [1 x ptr] [ptr @vf3_1], !type !2 41@vt3_2 = constant [1 x ptr] [ptr @vf3_2], !type !2 42 43declare i32 @vf3_1(ptr %this, i32 %arg) 44declare i32 @vf3_2(ptr %this, i32 %arg) 45 46@vt4_1 = constant [1 x ptr] [ptr @vf4_1], !type !3 47@vt4_2 = constant [1 x ptr] [ptr @vf4_2], !type !3 48 49declare i32 @vf4_1(ptr %this, i32 %arg) 50declare i32 @vf4_2(ptr %this, i32 %arg) 51 52define i32 @fn1(ptr %obj) #0 { 53 %vtable = load ptr, ptr %obj 54 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1") 55 call void @llvm.assume(i1 %p) 56 %fptr = load ptr, ptr %vtable 57 %result = call i32 %fptr(ptr %obj, i32 1) 58 ret i32 %result 59} 60 61define i32 @fn2(ptr %obj) #0 { 62 %vtable = load ptr, ptr %obj 63 %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid2") 64 call void @llvm.assume(i1 %p) 65 %fptr = load ptr, ptr %vtable 66 %result = call i32 %fptr(ptr %obj, i32 1) 67 ret i32 %result 68} 69 70define i32 @fn3(ptr %obj) #0 { 71 %vtable = load ptr, ptr %obj 72 %p = call i1 @llvm.type.test(ptr %vtable, metadata !4) 73 call void @llvm.assume(i1 %p) 74 %fptr = load ptr, ptr %vtable 75 %result = call i32 %fptr(ptr %obj, i32 1) 76 ret i32 %result 77} 78 79declare i1 @llvm.type.test(ptr, metadata) 80declare void @llvm.assume(i1) 81 82!0 = !{i32 0, !"typeid1"} 83!1 = !{i32 0, !"typeid2"} 84!2 = !{i32 0, !"typeid3"} 85!3 = !{i32 0, !4} 86!4 = distinct !{} 87 88attributes #0 = { "target-features"="+retpoline" } 89