1 ; RUN: opt -S --passes="ipsccp<func-spec>" -funcspec-max-clones=1 < %s | FileCheck %s
2 define internal i32 @f(i32 noundef %x, ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) noinline {
4 %call = tail call i32 %p(i32 noundef %x)
5 %call1 = tail call i32 %q(i32 noundef %x)
6 %add = add nsw i32 %call1, %call
10 define internal i32 @g(i32 noundef %x, ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) noinline {
12 %call = tail call i32 %p(i32 noundef %x)
13 %call1 = tail call i32 %q(i32 noundef %x)
14 %sub = sub nsw i32 %call, %call1
18 define i32 @h0(i32 noundef %x) {
20 %call = tail call i32 @f(i32 noundef %x, ptr noundef nonnull @pp, ptr noundef nonnull @qq)
24 define i32 @h1(i32 noundef %x) {
26 %call = tail call i32 @f(i32 noundef %x, ptr noundef nonnull @qq, ptr noundef nonnull @pp)
30 define i32 @h2(i32 noundef %x, ptr nocapture noundef readonly %p) {
32 %call = tail call i32 @g(i32 noundef %x, ptr noundef %p, ptr noundef nonnull @pp)
36 define i32 @h3(i32 noundef %x, ptr nocapture noundef readonly %p) {
38 %call = tail call i32 @g(i32 noundef %x, ptr noundef %p, ptr noundef nonnull @qq)
42 declare i32 @pp(i32 noundef)
43 declare i32 @qq(i32 noundef)
46 ; Check that the global ranking causes two specialisations of
47 ; `f` to be chosen, whereas the old algorithm would choose
48 ; one specialsation of `f` and one of `g`.
50 ; CHECK-DAG: define internal i32 @f.specialized.1
51 ; CHECK-DAG: define internal i32 @f.specialized.2