1 ; RUN: opt -passes="ipsccp<func-spec>" -funcspec-min-function-size=3 -S < %s | FileCheck %s
2 ; RUN: opt -passes="ipsccp<no-func-spec>" -funcspec-min-function-size=3 -S < %s | FileCheck %s --check-prefix=NOFSPEC
4 define i64 @main(i64 %x, i1 %flag) {
6 ; CHECK-LABEL: @main(i64 %x, i1 %flag) {
8 ; CHECK-NEXT: br i1 %flag, label %plus, label %minus
10 ; CHECK-NEXT: [[TMP0:%.+]] = call i64 @compute.specialized.1(i64 %x, ptr @plus)
11 ; CHECK-NEXT: br label %merge
13 ; CHECK-NEXT: [[TMP1:%.+]] = call i64 @compute.specialized.2(i64 %x, ptr @minus)
14 ; CHECK-NEXT: br label %merge
16 ; CHECK-NEXT: [[TMP2:%.+]] = phi i64 [ [[TMP0]], %plus ], [ [[TMP1]], %minus ]
17 ; CHECK-NEXT: ret i64 [[TMP2]]
20 ; NOFSPEC-LABEL: @main(i64 %x, i1 %flag) {
21 ; NOFSPEC-NOT: call i64 @compute.specialized.{{[0-9]+}}(
22 ; NOFSPEC: call i64 @compute(
25 br i1 %flag, label %plus, label %minus
28 %tmp0 = call i64 @compute(i64 %x, ptr @plus)
32 %tmp1 = call i64 @compute(i64 %x, ptr @minus)
36 %tmp2 = phi i64 [ %tmp0, %plus ], [ %tmp1, %minus]
40 ; CHECK-NOT: define internal i64 @compute(
42 ; CHECK-LABEL: define internal i64 @compute.specialized.1(i64 %x, ptr %binop) {
44 ; CHECK-NEXT: [[TMP0:%.+]] = call i64 @plus(i64 %x)
45 ; CHECK-NEXT: ret i64 [[TMP0]]
48 ; CHECK-LABEL: define internal i64 @compute.specialized.2(i64 %x, ptr %binop) {
50 ; CHECK-NEXT: [[TMP0:%.+]] = call i64 @minus(i64 %x)
51 ; CHECK-NEXT: ret i64 [[TMP0]]
54 ; NOFSPEC: define internal i64 @compute(
55 ; NOFSPEC-NOT: define internal i64 @compute.specialized.{{[0-9]+}}(
57 define internal i64 @compute(i64 %x, ptr %binop) {
59 %tmp0 = call i64 %binop(i64 %x)
63 define internal i64 @plus(i64 %x) {
69 define internal i64 @minus(i64 %x) {