1 ; RUN: opt -S --passes="ipsccp<func-spec>,deadargelim" -force-specialization < %s | FileCheck %s
2 define dso_local i32 @add(i32 %x, i32 %y) {
4 %add = add nsw i32 %y, %x
8 define dso_local i32 @sub(i32 %x, i32 %y) {
10 %sub = sub nsw i32 %x, %y
14 define internal i32 @f(i32 %x, i32 %y, ptr %u, ptr %v) noinline {
16 %call = tail call i32 %u(i32 %x, i32 %y)
17 %call1 = tail call i32 %v(i32 %x, i32 %y)
18 %mul = mul nsw i32 %call1, %call
22 define dso_local i32 @g0(i32 %x, i32 %y) {
24 ; CHECK: call i32 @f.specialized.3(i32 [[X:%.*]], i32 [[Y:%.*]])
26 %call = tail call i32 @f(i32 %x, i32 %y, ptr @add, ptr @add)
31 define dso_local i32 @g1(i32 %x, i32 %y) {
33 ; CHECK: call i32 @f.specialized.2(i32 [[X:%.*]], i32 [[Y:%.*]])
35 %call = tail call i32 @f(i32 %x, i32 %y, ptr @sub, ptr @add)
39 define dso_local i32 @g2(i32 %x, i32 %y, ptr %v) {
41 ; CHECK: call i32 @f.specialized.1(i32 [[X:%.*]], i32 [[Y:%.*]], ptr [[V:%.*]])
43 %call = tail call i32 @f(i32 %x, i32 %y, ptr @sub, ptr %v)
47 ; CHECK-LABEL: define {{.*}} i32 @f.specialized.1
48 ; CHECK: call i32 @sub(i32 %x, i32 %y)
49 ; CHECK-NEXT: call i32 %v(i32 %x, i32 %y)
51 ; CHECK-LABEL: define {{.*}} i32 @f.specialized.2
52 ; CHECK: call i32 @sub(i32 %x, i32 %y)
53 ; CHECK-NEXT: call i32 @add(i32 %x, i32 %y)
55 ; CHECK-LABEL: define {{.*}} i32 @f.specialized.3
56 ; CHECK: call i32 @add(i32 %x, i32 %y)
57 ; CHECK-NEXT: call i32 @add(i32 %x, i32 %y)