1 ; RUN: opt < %s -passes=print-callgraph -disable-output 2>&1 | FileCheck %s
2 ; CHECK: Call graph node <<null function>><<{{.*}}>> #uses=0
3 ; CHECK-NEXT: CS<None> calls function 'other_intrinsic_use'
4 ; CHECK-NEXT: CS<None> calls function 'other_cast_intrinsic_use'
5 ; CHECK-NEXT: CS<None> calls function 'llvm.lifetime.start.p0'
6 ; CHECK-NEXT: CS<None> calls function 'llvm.memset.p0.i64'
7 ; CHECK-NEXT: CS<None> calls function 'llvm.memset.p1.i64'
9 ; CHECK-NEXT: Call graph node for function: 'addrspacecast_only'<<{{.*}}>> #uses=0
11 ; CHECK-NEXT: Call graph node for function: 'bitcast_only'<<{{.*}}>> #uses=0
13 ; CHECK-NEXT: Call graph node for function: 'llvm.lifetime.start.p0'<<{{.*}}>> #uses=3
15 ; CHECK-NEXT: Call graph node for function: 'llvm.memset.p0.i64'<<{{.*}}>> #uses=2
17 ; CHECK-NEXT: Call graph node for function: 'llvm.memset.p1.i64'<<{{.*}}>> #uses=2
19 ; CHECK-NEXT: Call graph node for function: 'other_cast_intrinsic_use'<<{{.*}}>> #uses=1
20 ; CHECK-NEXT: CS<{{.*}}> calls function 'llvm.memset.p1.i64'
22 ; CHECK-NEXT: Call graph node for function: 'other_intrinsic_use'<<{{.*}}>> #uses=1
23 ; CHECK-NEXT: CS<{{.*}}> calls function 'llvm.memset.p0.i64'
25 ; CHECK-NEXT: Call graph node for function: 'used_by_lifetime'<<{{.*}}>> #uses=0
26 ; CHECK-NEXT: CS<{{.*}}> calls function 'llvm.lifetime.start.p0'
28 ; CHECK-NEXT: Call graph node for function: 'used_by_lifetime_cast'<<{{.*}}>> #uses=0
29 ; CHECK-NEXT: CS<{{.*}}> calls function 'llvm.lifetime.start.p0'
32 define internal void @used_by_lifetime() {
34 call void @llvm.lifetime.start.p0(i64 4, ptr @used_by_lifetime)
38 define internal void @used_by_lifetime_cast() addrspace(1) {
39 call void @llvm.lifetime.start.p0(i64 4, ptr addrspacecast (ptr addrspace(1) @used_by_lifetime_cast to ptr))
43 define internal void @bitcast_only() {
45 %c = bitcast ptr @bitcast_only to ptr
49 define internal void @addrspacecast_only() addrspace(1) {
51 %c = addrspacecast ptr addrspace(1) @addrspacecast_only to ptr
55 define internal void @other_intrinsic_use() {
56 call void @llvm.memset.p0.i64(ptr @other_intrinsic_use, i8 0, i64 1024, i1 false)
60 define internal void @other_cast_intrinsic_use() {
61 call void @llvm.memset.p1.i64(ptr addrspace(1) addrspacecast (ptr @other_cast_intrinsic_use to ptr addrspace(1)), i8 0, i64 1024, i1 false)
65 declare void @llvm.lifetime.start.p0(i64, ptr nocapture)
66 declare void @llvm.memset.p0.i64(ptr, i8, i64, i1 immarg)
67 declare void @llvm.memset.p1.i64(ptr addrspace(1), i8, i64, i1 immarg)