1; RUN: opt -S --passes="ipsccp<func-spec>" -funcspec-for-literal-constant=false -funcspec-max-clones=1 < %s | FileCheck %s 2define internal i32 @f(i32 noundef %x, ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) noinline { 3entry: 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 7 ret i32 %add 8} 9 10define internal i32 @g(i32 noundef %x, ptr nocapture noundef readonly %p, ptr nocapture noundef readonly %q) noinline { 11entry: 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 15 ret i32 %sub 16} 17 18define i32 @h0(i32 noundef %x) { 19entry: 20 %call = tail call i32 @f(i32 noundef %x, ptr noundef nonnull @pp, ptr noundef nonnull @qq) 21 ret i32 %call 22} 23 24define i32 @h1(i32 noundef %x) { 25entry: 26 %call = tail call i32 @f(i32 noundef %x, ptr noundef nonnull @qq, ptr noundef nonnull @pp) 27 ret i32 %call 28} 29 30define i32 @h2(i32 noundef %x, ptr nocapture noundef readonly %p) { 31entry: 32 %call = tail call i32 @g(i32 noundef %x, ptr noundef %p, ptr noundef nonnull @pp) 33 ret i32 %call 34} 35 36define i32 @h3(i32 noundef %x, ptr nocapture noundef readonly %p) { 37entry: 38 %call = tail call i32 @g(i32 noundef %x, ptr noundef %p, ptr noundef nonnull @qq) 39 ret i32 %call 40} 41 42declare i32 @pp(i32 noundef) 43declare i32 @qq(i32 noundef) 44 45 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`. 49 50; CHECK-DAG: define internal i32 @f.specialized.1 51; CHECK-DAG: define internal i32 @f.specialized.2 52