<div dir="ltr">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. <div><br></div><div>I tried to do the following in my module pass:</div><div><div>    RegionInfoPass RIP;</div><div>    if (RIP.runOnFunction(*F1)) {</div><div>      assert(false && "Failed to run runOnFunction");</div><div>    }</div><div>    RegionInfo *RI = &RIP.getAnalysis<RegionInfoPass>().getRegionInfo();</div><div>    RI->dump();</div></div><div><div>It compiles without problem, but when I run it, I got the following errors:</div></div><div><div>    AnalysisType&llvm::Pass::getAnalysis() const [with AnalysisType = llvm::RegionInfoPass]:</div><div>    Assertion `Resolver && "Pass has not been inserted into a PassManager object!"' failed.</div></div><div><br></div><div>I also tried to use RGPassManager as below:</div><div><div>    RGPassManager RGPM;</div><div>    if (RGPM.runOnFunction(*F1)) {</div><div>      assert(false && "Failed to run runOnFunction");</div><div>    }</div></div><div>Again, it compiles without problem, but when I run it, I got the same errors as above.</div><div><br></div><div>Is anyone can show me what is the correct way for a module pass to use RegionInfo analysis?</div><div><br></div><div>Thanks,</div><div>Ming-Hwa</div><div><br></div></div>