I have to get the callgraph of a module before any module-level optimization passes are run and then use the callgraph info in a transformation pass which is run just before the vectorizer optimizations. I thought of writing an analysis pass which generates the callgraph using the internal LLVM callgraph class and then use it later in my tranformation pass. Does LLVM have any existing functionality to pass this generated callgraph across passes? Or is there any other way I should go about doing this?
Hi rish, you can try to inherit CallGraphWrapperPass with your analysisXXXPass. Then call it with
CallGraph &CG = getAnalysis<analysisXXXPass>().getCallGraph();
1 Like
Thanks for the solution!