[llvm-dev] Question about using LoopAccessLegacyAnalysis

Michael Meng via llvm-dev llvm-dev at lists.llvm.org
Fri Feb 9 12:04:47 PST 2018


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>


More information about the llvm-dev mailing list