2 ; RUN: opt -passes="ipsccp<func-spec>,inline,instcombine,simplifycfg" -S \
3 ; RUN: -funcspec-min-function-size=23 -funcspec-max-iters=100 \
4 ; RUN: -debug-only=function-specialization < %s 2>&1 | FileCheck %s
6 ; Make sure the number of specializations created are not
7 ; linear to the number of iterations (funcspec-max-iters).
9 ; CHECK: FnSpecialization: Created 4 specializations in module
11 @Global = internal constant i32 1, align 4
13 define internal void @recursiveFunc(ptr readonly %arg) {
14 %temp = alloca i32, align 4
15 %arg.load = load i32, ptr %arg, align 4
16 %arg.cmp = icmp slt i32 %arg.load, 10000
17 br i1 %arg.cmp, label %loop1, label %ret.block
32 call void @print_val(i32 %arg.load)
33 %arg.add = add nsw i32 %arg.load, 1
34 store i32 %arg.add, ptr %temp, align 4
35 call void @recursiveFunc(ptr %temp)
39 %exit_cond1 = call i1 @exit_cond()
40 br i1 %exit_cond1, label %loop4, label %loop3.end
43 %exit_cond2 = call i1 @exit_cond()
44 br i1 %exit_cond2, label %loop3, label %loop2.end
47 %exit_cond3 = call i1 @exit_cond()
48 br i1 %exit_cond3, label %loop2, label %loop1.end
51 %exit_cond4 = call i1 @exit_cond()
52 br i1 %exit_cond4, label %loop1, label %ret.block
59 call void @recursiveFunc(ptr @Global)
63 declare dso_local void @print_val(i32)
64 declare dso_local i1 @exit_cond()