xref: /llvm-project/llvm/test/Analysis/LazyCallGraph/remove-dead-function-spurious-ref-edge.ll (revision a8f1da128d86d86a3efc1e96e46ace725bf4f3cb)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -passes=argpromotion,inline -S %s | FileCheck %s
3
4; argpromo removes @b's parameter (removing @c's reference to @a without updating the ref edge in the call graph), then the inliner inlines @a into @d and attempts to remove @a.
5
6define internal void @a() alwaysinline {
7  call void @e(ptr @c)
8  ret void
9}
10
11define internal void @b(ptr) noinline {
12; CHECK-LABEL: @b(
13; CHECK-NEXT:    ret void
14;
15  ret void
16}
17
18define internal void @c() noinline {
19; CHECK-LABEL: @c(
20; CHECK-NEXT:    call void @b()
21; CHECK-NEXT:    ret void
22;
23  call void @b(ptr @a)
24  ret void
25}
26
27define void @d() {
28; CHECK-LABEL: @d(
29; CHECK-NEXT:    call void @e(ptr @c)
30; CHECK-NEXT:    ret void
31;
32  call void @a()
33  ret void
34}
35
36declare void @e(ptr);
37