1 ; RUN: opt -function-specialization -force-function-specialization -func-specialization-max-iters=2 -inline -instcombine -S < %s | FileCheck %s --check-prefix=ITERS2
2 ; RUN: opt -function-specialization -force-function-specialization -func-specialization-max-iters=3 -inline -instcombine -S < %s | FileCheck %s --check-prefix=ITERS3
3 ; RUN: opt -function-specialization -force-function-specialization -func-specialization-max-iters=4 -inline -instcombine -S < %s | FileCheck %s --check-prefix=ITERS4
5 @Global = internal constant i32 1, align 4
7 define internal void @recursiveFunc(i32* nocapture readonly %arg) {
8 %temp = alloca i32, align 4
9 %arg.load = load i32, i32* %arg, align 4
10 %arg.cmp = icmp slt i32 %arg.load, 4
11 br i1 %arg.cmp, label %block6, label %ret.block
14 call void @print_val(i32 %arg.load)
15 %arg.add = add nsw i32 %arg.load, 1
16 store i32 %arg.add, i32* %temp, align 4
17 call void @recursiveFunc(i32* nonnull %temp)
24 ; ITERS2: @funcspec.arg.3 = internal constant i32 3
25 ; ITERS3: @funcspec.arg.5 = internal constant i32 4
28 ; ITERS2-LABEL: @main(
29 ; ITERS2-NEXT: call void @print_val(i32 1)
30 ; ITERS2-NEXT: call void @print_val(i32 2)
31 ; ITERS2-NEXT: call void @recursiveFunc(i32* nonnull @funcspec.arg.3)
32 ; ITERS2-NEXT: ret i32 0
34 ; ITERS3-LABEL: @main(
35 ; ITERS3-NEXT: call void @print_val(i32 1)
36 ; ITERS3-NEXT: call void @print_val(i32 2)
37 ; ITERS3-NEXT: call void @print_val(i32 3)
38 ; ITERS3-NEXT: call void @recursiveFunc(i32* nonnull @funcspec.arg.5)
39 ; ITERS3-NEXT: ret i32 0
41 ; ITERS4-LABEL: @main(
42 ; ITERS4-NEXT: call void @print_val(i32 1)
43 ; ITERS4-NEXT: call void @print_val(i32 2)
44 ; ITERS4-NEXT: call void @print_val(i32 3)
45 ; ITERS4-NEXT: ret i32 0
47 call void @recursiveFunc(i32* nonnull @Global)
51 declare dso_local void @print_val(i32)