[llvm-dev] Question about using LoopAccessLegacyAnalysis

陳韋任 via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 8 07:06:30 PST 2018


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>


More information about the llvm-dev mailing list