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().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