1; RUN: opt < %s -print-callgraph -disable-output 2>&1 | FileCheck %s
2
3; The test will report used1 and used2 functions as used on the grounds
4; of llvm.*.used references. Passing IgnoreLLVMUsed = true into the
5; Function::hasAddressTaken() in the CallGraph::addToCallGraph() has to
6; change their uses to zero.
7
8; CHECK: Call graph node <<null function>><<{{.*}}>>  #uses=0
9; CHECK-NEXT:  CS<None> calls function 'used1'
10; CHECK-NEXT:  CS<None> calls function 'used2'
11; CHECK-NEXT:  CS<None> calls function 'unused'
12; CHECK-EMPTY:
13; CHECK-NEXT:   Call graph node for function: 'unused'<<{{.*}}>>  #uses=1
14; CHECK-EMPTY:
15; CHECK-NEXT:   Call graph node for function: 'used1'<<{{.*}}>>  #uses=1
16; CHECK-EMPTY:
17; CHECK-NEXT:   Call graph node for function: 'used2'<<{{.*}}>>  #uses=1
18; CHECK-EMPTY:
19
20@llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @used1 to i8*)]
21@llvm.compiler.used = appending global [1 x void()*] [void ()* @used2]
22@array = appending global [1 x i8*] [i8* bitcast (void ()* @unused to i8*)]
23
24define internal void @used1() {
25entry:
26  ret void
27}
28
29define internal void @used2() {
30entry:
31  ret void
32}
33
34define internal void @unused() {
35entry:
36  ret void
37}
38