1f952bc05SAlexandros Lamprineas; RUN: opt -S --passes="ipsccp<func-spec>" \ 2*06664fdcSHari Limaye; RUN: -funcspec-for-literal-constant=false \ 39627bcdeSAlexandros Lamprineas; RUN: -force-specialization < %s | FileCheck %s -check-prefix CHECK-NOLIT 4f952bc05SAlexandros Lamprineas; RUN: opt -S --passes="ipsccp<func-spec>" \ 59627bcdeSAlexandros Lamprineas; RUN: -force-specialization < %s | FileCheck %s -check-prefix CHECK-LIT 638f44ccfSMomchil Velikov 738f44ccfSMomchil Velikovdefine i32 @f0(i32 noundef %x) { 838f44ccfSMomchil Velikoventry: 938f44ccfSMomchil Velikov %call = tail call i32 @neg(i32 noundef %x, i1 noundef zeroext false) 1038f44ccfSMomchil Velikov ret i32 %call 1138f44ccfSMomchil Velikov} 1238f44ccfSMomchil Velikov 1338f44ccfSMomchil Velikovdefine i32 @f1(i32 noundef %x) { 1438f44ccfSMomchil Velikoventry: 1538f44ccfSMomchil Velikov %call = tail call i32 @neg(i32 noundef %x, i1 noundef zeroext true) 1638f44ccfSMomchil Velikov ret i32 %call 1738f44ccfSMomchil Velikov} 1838f44ccfSMomchil Velikov 1938f44ccfSMomchil Velikovdefine i32 @g0(i32 noundef %x) { 2038f44ccfSMomchil Velikoventry: 2138f44ccfSMomchil Velikov %call = tail call i32 @add(i32 noundef %x, i32 noundef 1) 2238f44ccfSMomchil Velikov ret i32 %call 2338f44ccfSMomchil Velikov} 2438f44ccfSMomchil Velikov 2538f44ccfSMomchil Velikovdefine i32 @g1(i32 noundef %x) { 2638f44ccfSMomchil Velikoventry: 2738f44ccfSMomchil Velikov %call = tail call i32 @add(i32 noundef %x, i32 noundef 2) 2838f44ccfSMomchil Velikov ret i32 %call 2938f44ccfSMomchil Velikov} 3038f44ccfSMomchil Velikov 3138f44ccfSMomchil Velikovdefine float @h0(float noundef %x) { 3238f44ccfSMomchil Velikoventry: 3338f44ccfSMomchil Velikov %call = tail call float @addf(float noundef %x, float noundef 1.000000e+00) 3438f44ccfSMomchil Velikov ret float %call 3538f44ccfSMomchil Velikov} 3638f44ccfSMomchil Velikov 3738f44ccfSMomchil Velikovdefine float @h1(float noundef %x) { 3838f44ccfSMomchil Velikoventry: 3938f44ccfSMomchil Velikov %call = tail call float @addf(float noundef %x, float noundef 2.000000e+00) 4038f44ccfSMomchil Velikov ret float %call 4138f44ccfSMomchil Velikov} 4238f44ccfSMomchil Velikov 4338f44ccfSMomchil Velikovdefine internal i32 @neg(i32 noundef %x, i1 noundef zeroext %b) { 4438f44ccfSMomchil Velikoventry: 4538f44ccfSMomchil Velikov %sub = sub nsw i32 0, %x 4638f44ccfSMomchil Velikov %cond = select i1 %b, i32 %sub, i32 %x 4738f44ccfSMomchil Velikov ret i32 %cond 4838f44ccfSMomchil Velikov} 4938f44ccfSMomchil Velikov 5038f44ccfSMomchil Velikovdefine internal i32 @add(i32 noundef %x, i32 noundef %y) { 5138f44ccfSMomchil Velikoventry: 5238f44ccfSMomchil Velikov %add = add nsw i32 %y, %x 5338f44ccfSMomchil Velikov ret i32 %add 5438f44ccfSMomchil Velikov} 5538f44ccfSMomchil Velikov 5638f44ccfSMomchil Velikovdefine internal float @addf(float noundef %x, float noundef %y) { 5738f44ccfSMomchil Velikoventry: 5838f44ccfSMomchil Velikov %add = fadd float %x, %y 5938f44ccfSMomchil Velikov ret float %add 6038f44ccfSMomchil Velikov} 6138f44ccfSMomchil Velikov 6238f44ccfSMomchil Velikov 6338f44ccfSMomchil Velikov; Check no functions were specialised. 6438f44ccfSMomchil Velikov; CHECK-NOLIT-NOT: @neg. 6538f44ccfSMomchil Velikov; CHECK-NOLIT-NOT: @add. 6638f44ccfSMomchil Velikov; CHECK-NOLIT-NOT: @addf. 6738f44ccfSMomchil Velikov 6838f44ccfSMomchil Velikov; CHECK-LIT-LABEL: define i32 @f0 69e15d72adSAlexandros Lamprineas; CHECK-LIT: call i32 @neg.specialized.[[#A:]] 7038f44ccfSMomchil Velikov 7138f44ccfSMomchil Velikov; CHECK-LIT-LABEL: define i32 @f1 72e15d72adSAlexandros Lamprineas; CHECK-LIT: call i32 @neg.specialized.[[#B:]] 7338f44ccfSMomchil Velikov 7493de97d7SAndreas Jonson; CHECK-LIT-LABEL: define range(i32 -2147483647, -2147483648) i32 @g0 75e15d72adSAlexandros Lamprineas; CHECK-LIT: call i32 @add.specialized.[[#C:]] 7638f44ccfSMomchil Velikov 7793de97d7SAndreas Jonson; CHECK-LIT-LABEL: define range(i32 -2147483647, -2147483648) i32 @g1 78e15d72adSAlexandros Lamprineas; CHECK-LIT: call i32 @add.specialized.[[#D:]] 7938f44ccfSMomchil Velikov 8038f44ccfSMomchil Velikov; CHECK-LIT-LABEL: define float @h0 81e15d72adSAlexandros Lamprineas; CHECK-LIT: call float @addf.specialized.[[#E:]] 8238f44ccfSMomchil Velikov 8338f44ccfSMomchil Velikov; CHECK-LIT-LABEL: define float @h1 84e15d72adSAlexandros Lamprineas; CHECK-LIT: call float @addf.specialized.[[#F:]] 8538f44ccfSMomchil Velikov 8638f44ccfSMomchil Velikov; Check all of `neg`, `add`, and `addf` were specialised. 87e15d72adSAlexandros Lamprineas; CHECK-LIT-DAG: @neg.specialized.[[#A]] 88e15d72adSAlexandros Lamprineas; CHECK-LIT-DAG: @neg.specialized.[[#B]] 89e15d72adSAlexandros Lamprineas; CHECK-LIT-DAG: @add.specialized.[[#C]] 90e15d72adSAlexandros Lamprineas; CHECK-LIT-DAG: @add.specialized.[[#D]] 91e15d72adSAlexandros Lamprineas; CHECK-LIT-DAG: @addf.specialized.[[#E]] 92e15d72adSAlexandros Lamprineas; CHECK-LIT-DAG: @addf.specialized.[[#F]] 93