[LLVMdev] Do all user-written passes have to be run through a PassManager object (called from outside the LLVM infrastructure)?
jgai at illinois.edu
Thu Jan 16 09:44:31 PST 2014
I have written several passes that have no pre-requisites for any
previous LLVM native passes prior to my own. For those passes, I have verified that at
least the following two approaches are equivalent in terms of executing
those self-written passes and getting the correct results:
AnalyzeKind *abk = new AnalyzeKind(F);
However, I found that if my own pass has requirements, e.g.
Then, only method 1 can work; The following error msg was what
I got from using method 2:
LLVM/llvm-3.3.src/include/llvm/PassAnalysisSupport.h:200: AnalysisType& llvm::Pass::getAnalysis() const [with AnalysisType = llvm::DominatorTree]: Assertion `Resolver && "Pass has not been inserted into a PassManager object!"' failed.
Note: I have added "initializeDominatorTreePass(*PassRegistry::getPassRegistry());"
to the constructor of my own pass;
More information about the llvm-dev