1; RUN: opt < %s -passes=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 'used_addrspace1' 12; CHECK-NEXT: CS<None> calls function 'unused' 13; CHECK-EMPTY: 14; CHECK-NEXT: Call graph node for function: 'unused'<<{{.*}}>> #uses=1 15; CHECK-EMPTY: 16; CHECK-NEXT: Call graph node for function: 'used1'<<{{.*}}>> #uses=1 17; CHECK-EMPTY: 18; CHECK-NEXT: Call graph node for function: 'used2'<<{{.*}}>> #uses=1 19; CHECK-EMPTY: 20; CHECK-NEXT: Call graph node for function: 'used_addrspace1'<<{{.*}}>> #uses=1 21; CHECK-EMPTY: 22 23@llvm.used = appending global [2 x ptr] [ptr @used1, ptr addrspacecast (ptr addrspace(1) @used_addrspace1 to ptr)] 24@llvm.compiler.used = appending global [1 x ptr] [ptr @used2] 25@array = appending global [1 x ptr] [ptr @unused] 26 27define internal void @used1() { 28entry: 29 ret void 30} 31 32define internal void @used2() { 33entry: 34 ret void 35} 36 37define internal void @used_addrspace1() addrspace(1) { 38entry: 39 ret void 40} 41 42define internal void @unused() { 43entry: 44 ret void 45} 46