xref: /llvm-project/llvm/test/Transforms/FunctionSpecialization/function-specialization-minsize2.ll (revision e15d72adac66790a78a51a3087b56b2bde6b778a)
1; RUN: opt -passes="ipsccp<func-spec>" -funcspec-min-function-size=3 -S < %s | FileCheck %s
2
3; Checks for callsites that have been annotated with MinSize. No specialisation
4; expected here:
5;
6; CHECK-NOT: @compute.specialized.1
7; CHECK-NOT: @compute.specialized.2
8
9define i64 @main(i64 %x, i1 %flag) {
10entry:
11  br i1 %flag, label %plus, label %minus
12
13plus:
14  %tmp0 = call i64 @compute(i64 %x, ptr @plus) #0
15  br label %merge
16
17minus:
18  %tmp1 = call i64 @compute(i64 %x, ptr @minus) #0
19  br label %merge
20
21merge:
22  %tmp2 = phi i64 [ %tmp0, %plus ], [ %tmp1, %minus]
23  ret i64 %tmp2
24}
25
26define internal i64 @compute(i64 %x, ptr %binop) {
27entry:
28  %tmp0 = call i64 %binop(i64 %x)
29  ret i64 %tmp0
30}
31
32define internal i64 @plus(i64 %x) {
33entry:
34  %tmp0 = add i64 %x, 1
35  ret i64 %tmp0
36}
37
38define internal i64 @minus(i64 %x) {
39entry:
40  %tmp0 = sub i64 %x, 1
41  ret i64 %tmp0
42}
43
44attributes #0 = { minsize optsize }
45