46 lines · plain
1; RUN: opt < %s -passes=print-callgraph -disable-output 2>&1 | FileCheck %s2 3; The test will report used1 and used2 functions as used on the grounds4; of llvm.*.used references. Passing IgnoreLLVMUsed = true into the5; Function::hasAddressTaken() in the CallGraph::addToCallGraph() has to6; change their uses to zero.7 8; CHECK: Call graph node <<null function>><<{{.*}}>> #uses=09; 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=115; CHECK-EMPTY:16; CHECK-NEXT: Call graph node for function: 'used1'<<{{.*}}>> #uses=117; CHECK-EMPTY:18; CHECK-NEXT: Call graph node for function: 'used2'<<{{.*}}>> #uses=119; CHECK-EMPTY:20; CHECK-NEXT: Call graph node for function: 'used_addrspace1'<<{{.*}}>> #uses=121; 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 void30}31 32define internal void @used2() {33entry:34 ret void35}36 37define internal void @used_addrspace1() addrspace(1) {38entry:39 ret void40}41 42define internal void @unused() {43entry:44 ret void45}46