xref: /llvm-project/llvm/test/Transforms/FunctionSpecialization/noinline.ll (revision 0d1a91e8f91e364b83f77e597dfb835d70fe9cf9)
1; RUN: opt -S --passes="ipsccp<func-spec>" -funcspec-for-literal-constant=false < %s | FileCheck %s
2define dso_local i32 @p0(i32 noundef %x) {
3entry:
4  %add = add nsw i32 %x, 1
5  ret i32 %add
6}
7
8define dso_local i32 @p1(i32 noundef %x) {
9entry:
10  %sub = add nsw i32 %x, -1
11  ret i32 %sub
12}
13
14define internal fastcc i32 @f(i32 noundef %x, ptr nocapture noundef readonly %p) noinline {
15entry:
16  %call = tail call i32 %p(i32 noundef %x)
17  %add = add nsw i32 %call, %x
18  ret i32 %add
19}
20
21define dso_local i32 @g0(i32 noundef %x) {
22entry:
23  %call = tail call fastcc i32 @f(i32 noundef %x, ptr noundef nonnull @p0)
24  ret i32 %call
25}
26
27define dso_local i32 @g1(i32 noundef %x) {
28entry:
29  %call = tail call fastcc i32 @f(i32 noundef %x, ptr noundef nonnull @p1)
30  ret i32 %call
31}
32
33; Check that a noinline function is specialized, even if it's small.
34; CHECK: @f.specialized.1
35; CHECK: @f.specialized.2
36