xref: /llvm-project/llvm/test/Transforms/Inline/inline-cost-dead-users.ll (revision 151602c7a9935558ca671b35359989b261045db0)
1; Test to ensure that the inlining cost model isn't tripped up by dead constant users.
2; In this case, the call to g via a bitcasted function pointer is canonicalized to
3; a direct call to g with bitcasted arguments, leaving the original bitcast
4; as a dead use of g.
5
6; RUN: opt < %s  -passes='function(instcombine),cgscc(inline)' -pass-remarks=inline -S 2>&1 \
7; RUN:     | FileCheck %s
8
9; Inline costs of f and g should be the same.
10
11; CHECK: 'f' inlined into 'h' with (cost=[[EXPECTED_COST:.+]], threshold={{.+}})
12; CHECK: 'g' inlined into 'h' with (cost=[[EXPECTED_COST]], threshold={{.+}})
13
14%0 = type { i64, i64, i64 }
15%1 = type { i64, i64, i64 }
16
17define internal void @f(ptr align 8 %a) unnamed_addr {
18start:
19  ret void
20}
21
22define internal void @g(ptr align 8 %a) unnamed_addr {
23start:
24  ret void
25}
26
27define void @h(ptr align 8 %a, ptr align 8 %b) unnamed_addr {
28start:
29  call void @f(ptr align 8 %a)
30  call void @g(ptr align 8 %b)
31  ret void
32}
33