[llvm-dev] Question about using LoopAccessLegacyAnalysis
Kewen Meng via llvm-dev
llvm-dev at lists.llvm.org
Wed Feb 7 09:49:32 PST 2018
Hi LLVM community,
I am writing a custom pass for analyzing the dependence information for the memory access within a loop. I found “LoopAccessLegacyAnalysis” class useful, however I m not able to obtain information from that pass. Here is what I did to get the information:
// require pass
virtual void getAnalysisUsage(AnalysisUsage &AU) const
{
AU.addRequired<LoopInfoWrapperPass>();
AU.addRequired<LoopAccessLegacyAnalysis>();
AU.setPreservesAll();
}
// processing
virtual bool runOnFunction(Function &F) {
LoopInfo &li = getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
LoopAccessLegacyAnalysis &lala = getAnalysis<LoopAccessLegacyAnalysis>();
for(LoopInfo::iterator lp = li.begin(); lp != li.end(); lp++)
{
Loop *loop = *lp;
const LoopAccessInfo &lai = lala.getInfo(loop);
// need help here
// I can’t get any information from the LoopAccessInfo instance.
errs()<<lai.getNumLoads(); // return 0
}
}
// register
static RegisterPass<SkeletonPass> X("test", "test for using the existing pass",
“false",
“false”);
I must be missing something important. Any response would be greatly appreciated!
Thanks,
Kewen
Best regards,
Kewen
More information about the llvm-dev
mailing list