1 ; RUN: opt -S --passes="ipsccp<func-spec>" \
2 ; RUN: -force-specialization < %s | FileCheck %s -check-prefix CHECK-NOLIT
3 ; RUN: opt -S --passes="ipsccp<func-spec>" \
4 ; RUN: -funcspec-for-literal-constant \
5 ; RUN: -force-specialization < %s | FileCheck %s -check-prefix CHECK-LIT
7 define i32 @f0(i32 noundef %x) {
9 %call = tail call i32 @neg(i32 noundef %x, i1 noundef zeroext false)
13 define i32 @f1(i32 noundef %x) {
15 %call = tail call i32 @neg(i32 noundef %x, i1 noundef zeroext true)
19 define i32 @g0(i32 noundef %x) {
21 %call = tail call i32 @add(i32 noundef %x, i32 noundef 1)
25 define i32 @g1(i32 noundef %x) {
27 %call = tail call i32 @add(i32 noundef %x, i32 noundef 2)
31 define float @h0(float noundef %x) {
33 %call = tail call float @addf(float noundef %x, float noundef 1.000000e+00)
37 define float @h1(float noundef %x) {
39 %call = tail call float @addf(float noundef %x, float noundef 2.000000e+00)
43 define internal i32 @neg(i32 noundef %x, i1 noundef zeroext %b) {
45 %sub = sub nsw i32 0, %x
46 %cond = select i1 %b, i32 %sub, i32 %x
50 define internal i32 @add(i32 noundef %x, i32 noundef %y) {
52 %add = add nsw i32 %y, %x
56 define internal float @addf(float noundef %x, float noundef %y) {
58 %add = fadd float %x, %y
63 ; Check no functions were specialised.
64 ; CHECK-NOLIT-NOT: @neg.
65 ; CHECK-NOLIT-NOT: @add.
66 ; CHECK-NOLIT-NOT: @addf.
68 ; CHECK-LIT-LABEL: define i32 @f0
69 ; CHECK-LIT: call i32 @neg.specialized.[[#A:]]
71 ; CHECK-LIT-LABEL: define i32 @f1
72 ; CHECK-LIT: call i32 @neg.specialized.[[#B:]]
74 ; CHECK-LIT-LABEL: define i32 @g0
75 ; CHECK-LIT: call i32 @add.specialized.[[#C:]]
77 ; CHECK-LIT-LABEL: define i32 @g1
78 ; CHECK-LIT: call i32 @add.specialized.[[#D:]]
80 ; CHECK-LIT-LABEL: define float @h0
81 ; CHECK-LIT: call float @addf.specialized.[[#E:]]
83 ; CHECK-LIT-LABEL: define float @h1
84 ; CHECK-LIT: call float @addf.specialized.[[#F:]]
86 ; Check all of `neg`, `add`, and `addf` were specialised.
87 ; CHECK-LIT-DAG: @neg.specialized.[[#A]]
88 ; CHECK-LIT-DAG: @neg.specialized.[[#B]]
89 ; CHECK-LIT-DAG: @add.specialized.[[#C]]
90 ; CHECK-LIT-DAG: @add.specialized.[[#D]]
91 ; CHECK-LIT-DAG: @addf.specialized.[[#E]]
92 ; CHECK-LIT-DAG: @addf.specialized.[[#F]]