<div dir="ltr">Hello,<div><br></div><div>I'm working with an old project that has a bunch of custom passes, and trying to get it to run with the most recent version of the flang LLVM compiler.</div><div><br></div><div>I've upgraded the project to use the flang llvm fork (approx. LLVM 7.1) from 3.0 and gotten it to compile, but am running into an issue with pass registration and getAnalysis().</div><div><br></div><div>Specifically, the pass 'Operators' needs to call getAnalysis() on a 'ParseConfig' pass to continue;</div><div><br></div><div>ParseConfig &parseConfig = getAnalysis<ParseConfig>();</div><div><br></div><div>but fails an assertion with;</div><div><br></div><div>"AnalysisType& llvm::Pass::getAnalysisID(llvm::AnalysisID) const [with AnalysisType = ParseConfig; llvm::AnalysisID = const void*]: Assertion `ResultPass && "getAnalysis*() called on an analysis that was not " "'required' by pass!"' failed."</div><div><br></div><div>I've sorted through every google search I can and all the llvm library calls to try and fix this. The following is true;</div><div><br></div><div>- Both Operators and ParseConfig passes inherit from ModulePass</div><div>- Operators overrides getAnalysisUsage() and adds ParseConfig as required.</div><div>- ParseConfig correctly calls the RegisterPass<> template and is registered.</div><div>- I've tried using RegisterStandardPasses() as described here: <a href="https://github.com/sampsyo/llvm-pass-skeleton/issues/7">https://github.com/sampsyo/llvm-pass-skeleton/issues/7</a> and the code is run, but the assertion still fails.</div><div>- I've stepped through the registration of ParseConfig with GDB and it registers successfully, and I've stepped through the getAnalysis() call from Operators and the assertion fails at AnalysisResolver::findImplPass(), as the AnalysisImpls list is always empty (<a href="https://llvm.org/doxygen/PassAnalysisSupport_8h_source.html#l00155">https://llvm.org/doxygen/PassAnalysisSupport_8h_source.html#l00155</a>) this is the 10.0 code, but the library is the same as the flang LLVM.</div><div><br></div><div>One thing I haven't fully figured out is how both passes inheriting from ModulePass affects this. Most people who have had this issue have simply been trying to use a Function pass in a module pass class or something similar, but all I need is all the info gathered from the previous ParseConfig pass to start working in the Operators pass, and both are done on a module level.</div><div><br></div><div>I'm pretty much at a loss at this point. If anyone is well versed with pass registration and getAnalysis that could provide some insight, I'd greatly appreciate it. I can also provide more information as needed.</div><div><br></div><div>Thanks,<br clear="all"><div><br></div>- Trevor</div></div>