1 ; RUN: opt -function-specialization -func-specialization-size-threshold=3 -S < %s | FileCheck %s
3 define i64 @main(i64 %x, i1 %flag) {
5 ; CHECK-LABEL: @main(i64 %x, i1 %flag) {
7 ; CHECK-NEXT: br i1 %flag, label %plus, label %minus
9 ; CHECK-NEXT: [[TMP0:%.+]] = call i64 @compute.1(i64 %x, i64 (i64)* @plus)
10 ; CHECK-NEXT: br label %merge
12 ; CHECK-NEXT: [[TMP1:%.+]] = call i64 @compute.2(i64 %x, i64 (i64)* @minus)
13 ; CHECK-NEXT: br label %merge
15 ; CHECK-NEXT: [[TMP2:%.+]] = phi i64 [ [[TMP0]], %plus ], [ [[TMP1]], %minus ]
16 ; CHECK-NEXT: ret i64 [[TMP2]]
20 br i1 %flag, label %plus, label %minus
23 %tmp0 = call i64 @compute(i64 %x, i64 (i64)* @plus)
27 %tmp1 = call i64 @compute(i64 %x, i64 (i64)* @minus)
31 %tmp2 = phi i64 [ %tmp0, %plus ], [ %tmp1, %minus]
35 ; CHECK-NOT: define internal i64 @compute(
37 ; CHECK-LABEL: define internal i64 @compute.1(i64 %x, i64 (i64)* %binop) {
39 ; CHECK-NEXT: [[TMP0:%.+]] = call i64 @plus(i64 %x)
40 ; CHECK-NEXT: ret i64 [[TMP0]]
43 ; CHECK-LABEL: define internal i64 @compute.2(i64 %x, i64 (i64)* %binop) {
45 ; CHECK-NEXT: [[TMP0:%.+]] = call i64 @minus(i64 %x)
46 ; CHECK-NEXT: ret i64 [[TMP0]]
49 define internal i64 @compute(i64 %x, i64 (i64)* %binop) {
51 %tmp0 = call i64 %binop(i64 %x)
55 define internal i64 @plus(i64 %x) {
61 define internal i64 @minus(i64 %x) {