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