Kewen Meng via llvm-dev
2018-Feb-07 17:49 UTC
[llvm-dev] Question about using LoopAccessLegacyAnalysis
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
陳韋任 via llvm-dev
2018-Feb-08 15:06 UTC
[llvm-dev] Question about using LoopAccessLegacyAnalysis
Have you check `LoopAccessLegacyAnalysis::runOnFunction` ran as you expect? Besides, I am not sure if `LoopAccessLegacyAnalysis::runOnFunction` does anything useful, have you check that, too? 2018-02-08 1:49 GMT+08:00 Kewen Meng via llvm-dev <llvm-dev at lists.llvm.org>:> 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 > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-- Wei-Ren Chen (陳韋任) Homepage: https://people.cs.nctu.edu.tw/~chenwj -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180208/1b9b3b21/attachment.html>
Michael Meng via llvm-dev
2018-Feb-09 20:04 UTC
[llvm-dev] Question about using LoopAccessLegacyAnalysis
Hi Wei-Ren,
Thanks for your reply.
I use --debug-pass=Structure and it says Loop access analysis pass is executed
before my pass. The interesting part is when I use -mem2reg and -loop-rotate it
returns dependence information. I have no idea how to explain that. I would be
great if one could help me with it. Thanks in advance.
Best,
Kewen
________________________________
From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of 陳韋任 via
llvm-dev <llvm-dev at lists.llvm.org>
Sent: Thursday, February 8, 2018 7:06:30 AM
To: Kewen Meng
Cc: LLVM Developers Mailing List
Subject: Re: [llvm-dev] Question about using LoopAccessLegacyAnalysis
Have you check `LoopAccessLegacyAnalysis::runOnFunction` ran as you expect?
Besides, I am not sure if `LoopAccessLegacyAnalysis::runOnFunction` does
anything useful, have you check that, too?
2018-02-08 1:49 GMT+08:00 Kewen Meng via llvm-dev <llvm-dev at
lists.llvm.org<mailto:llvm-dev at lists.llvm.org>>:
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
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
--
Wei-Ren Chen (陳韋任)
Homepage: https://people.cs.nctu.edu.tw/~chenwj
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180209/b6ad05e4/attachment.html>
Possibly Parallel Threads
- Question about using LoopAccessLegacyAnalysis
- Question about using LoopAccessLegacyAnalysis
- Confusing ERROR with LoopAccessLegacyAnalysis: Pass 'Unnamed pass: implement Pass::getPassName()' is not initialized.
- Problems with registering of ModulePass (with Dependencies)
- Unable to find requested analysis info (Interesting Assertion Failture for Specific Target Source Code)