llvm.org GIT mirror llvm / e65d39a
Teach -callgraph to always print the callgraph (as the description says it does), not just when -analyze is used as well. This means printing to stderr, so adjust some tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56337 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan Sands 11 years ago
4 changed file(s) with 8 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output | grep {Calls function 'callee'} | count 2
0 ; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls function 'callee'} | count 2
11
22 define internal void @callee(...) {
33 entry:
None ; RUN: llvm-as < %s | opt -analyze -callgraph -disable-output | grep {Calls function}
0 ; RUN: llvm-as < %s | opt -callgraph -disable-output |& grep {Calls function}
11
22 @a = global void ()* @f ; [#uses=0]
33
0 ; Call graph construction crash: Not handling indirect calls right
11 ;
2 ; RUN: llvm-as < %s | opt -analyze -callgraph
2 ; RUN: llvm-as < %s | opt -analyze -callgraph >& /dev/null
33 ;
44
55 %FunTy = type i32 (i32)
6565 char ExternalFunctionsPassedConstants::ID = 0;
6666 RegisterPass
6767 P1("externalfnconstants", "Print external fn callsites passed constants");
68
68
6969 struct CallGraphPrinter : public ModulePass {
7070 static char ID; // Pass ID, replacement for typeid
7171 CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
7474 AU.setPreservesAll();
7575 AU.addRequiredTransitive();
7676 }
77 virtual bool runOnModule(Module &M) { return false; }
78
79 virtual void print(std::ostream &OS, const Module *M) const {
80 getAnalysis().print(OS, M);
77 virtual bool runOnModule(Module &M) {
78 getAnalysis().print(std::cerr, &M);
79 return false;
8180 }
8281 };
83
82
8483 char CallGraphPrinter::ID = 0;
8584 RegisterPass
8685 P2("callgraph", "Print a call graph");