Hi, I am trying to write my own command-line tool which would use alias analysis in a CallGraphSCCPass. Firstly, I inherit a class AnalysisDriver from CallGraphSCCPass. Then, I implement my own runOnFunction method which tries to get alias analysis from each function. The code is shown as follows: *class AnalysisDriver : public CallGraphSCCPass {* * static char Pid;* * PassManager &passMgr;* * * *public:* * AnalysisDriver(PassManager &pmgr);* * ~AnalysisDriver();* * * * virtual void getAnalysisUsage(AnalysisUsage &AU) const {* * AU.addRequired<CallGraph>();* * AU.addRequired<AliasAnalysis>();* * AU.addPreserved<AliasAnalysis>();* * }* * * * bool run(Module &module);* * virtual bool runOnSCC(CallGraphSCC &scc);* * virtual bool runOnFunction(Function *f) = 0;* * * * virtual const char *getPassName() const {* * return "AnalysisDriver";* * }* * * *private:* * void registerDriver();* *};* *char AnalysisDriver::Pid;* * * *AnalysisDriver::AnalysisDriver(PassManager &pmgr)* * : CallGraphSCCPass(Pid), passMgr(pmgr) {* * registerDriver();* *}* * * *AnalysisDriver::~AnalysisDriver() {}* * * *void AnalysisDriver::registerDriver() {* * PassRegistry &Registry = *PassRegistry::getPassRegistry();* * * * // Register AliasAnalysis and CallGraph pass* * INITIALIZE_AG_DEPENDENCY(AliasAnalysis);* * INITIALIZE_AG_DEPENDENCY(CallGraph);* * * * passMgr.add(this);* *}* * * *bool AnalysisDriver::run(Module &module) {* * passMgr.run(module);* *}* * * *bool AnalysisDriver::runOnSCC(CallGraphSCC &scc) {* * for (CallGraphSCC::iterator i = scc.begin(),* * e = scc.end(); i != e; ++i) {* * CallGraphNode *cgnode = *i;* * Function *f = cgnode->getFunction();* * if (f == NULL || f->isDeclaration())* * continue;* * * * runOnFunction(f);* * }* * return false;* *}* * * *bool AnalysisDriver::runOnFunction(Function *f) {* * AliasAnalysis &aa = getAnalysis<AliasAnalysis>(*f);* * ...* *}* * * *int main(void) {* * ...* * PassManager passMgr;* * AnalysisDriver *d = new AnalysisDriver(passMgr);* * d->run(module);* * return 0;* *}* When I try to get alias analysis, it complains: "Unable to find on the fly pass" "UNREACHABLE executed at ./llvm/lib/IR/PassManager.cpp:1254!" The debug pass details: Pass Arguments: -no-aa -basiccg No Alias Analysis (always returns 'may' alias) ModulePass Manager Basic CallGraph Construction Call Graph SCC Pass Manager AnalysisDriver 0x1b15dd0 Executing Pass 'Basic CallGraph Construction' on Module 'alias.s'... 0x1b15dd0 Executing Pass 'CallGraph Pass Manager' on Module 'alias.s'... 0x1b154a0 Required Analyses: Basic CallGraph Construction 0x1b154c0 Executing Pass 'AnalysisDriver' on Call Graph Nodes 'Call graph node for function: 'f'<<0x1b1b350>> #uses=1 '... 0x1b106e0 Required Analyses: Basic CallGraph Construction, No Alias Analysis (always returns 'may' alias) Do I miss something? By the way, how do I use basicaa instead of no-aa? Thank you! -- Zhenbo Xu -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130923/94a8b2a3/attachment.html>