52 lines · plain
1; RUN: opt -S --passes="ipsccp<func-spec>" -funcspec-for-literal-constant=false -funcspec-max-clones=1 < %s | FileCheck %s2define 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, %call7 ret i32 %add8}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, %call115 ret i32 %sub16}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 %call22}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 %call28}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 %call34}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 %call40}41 42declare i32 @pp(i32 noundef)43declare i32 @qq(i32 noundef)44 45 46; Check that the global ranking causes two specialisations of47; `f` to be chosen, whereas the old algorithm would choose48; one specialsation of `f` and one of `g`.49 50; CHECK-DAG: define internal i32 @f.specialized.151; CHECK-DAG: define internal i32 @f.specialized.252