Minghwa Wang via llvm-dev
2016-Sep-19 17:53 UTC
[llvm-dev] How a module pass can use analysis information?
I am trying to write a llvm module pass by overriding the runOnModule(Module &M), but my pass needs the RegioinInfo analysis to find regions to get my pass working. I tried to do the following in my module pass: RegionInfoPass RIP; if (RIP.runOnFunction(*F1)) { assert(false && "Failed to run runOnFunction"); } RegionInfo *RI = &RIP.getAnalysis<RegionInfoPass>().getRegionInfo(); RI->dump(); It compiles without problem, but when I run it, I got the following errors: AnalysisType&llvm::Pass::getAnalysis() const [with AnalysisType llvm::RegionInfoPass]: Assertion `Resolver && "Pass has not been inserted into a PassManager object!"' failed. I also tried to use RGPassManager as below: RGPassManager RGPM; if (RGPM.runOnFunction(*F1)) { assert(false && "Failed to run runOnFunction"); } Again, it compiles without problem, but when I run it, I got the same errors as above. Is anyone can show me what is the correct way for a module pass to use RegionInfo analysis? Thanks, Ming-Hwa -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160919/3d347433/attachment.html>
Michael Kruse via llvm-dev
2016-Sep-20 16:48 UTC
[llvm-dev] How a module pass can use analysis information?
Using the legacy pass manager, it is generally not possible to use lower-level passes (The only exception is that module passes can use function passes using `getOnTheFlyPass`). You can still create your own pass manager hierachy. An example is here: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodegenCleanup.cpp?revision=274595&view=markup You need to create a whole stack of pass managers. Unfortunately I don't know how to reuse the dependent analyses from the 'main' pass manager stack (eg. TargetLibraryInfoWrapperPass) Michael 2016-09-19 19:53 GMT+02:00 Minghwa Wang via llvm-dev <llvm-dev at lists.llvm.org>:> I am trying to write a llvm module pass by overriding the runOnModule(Module > &M), but my pass needs the RegioinInfo analysis to find regions to get my > pass working. > > I tried to do the following in my module pass: > RegionInfoPass RIP; > if (RIP.runOnFunction(*F1)) { > assert(false && "Failed to run runOnFunction"); > } > RegionInfo *RI = &RIP.getAnalysis<RegionInfoPass>().getRegionInfo(); > RI->dump(); > It compiles without problem, but when I run it, I got the following errors: > AnalysisType&llvm::Pass::getAnalysis() const [with AnalysisType > llvm::RegionInfoPass]: > Assertion `Resolver && "Pass has not been inserted into a PassManager > object!"' failed. > > I also tried to use RGPassManager as below: > RGPassManager RGPM; > if (RGPM.runOnFunction(*F1)) { > assert(false && "Failed to run runOnFunction"); > } > Again, it compiles without problem, but when I run it, I got the same errors > as above. > > Is anyone can show me what is the correct way for a module pass to use > RegionInfo analysis? > > Thanks, > Ming-Hwa > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >