<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Have you check `LoopAccessLegacyAnalysis::runOnFunction` ran as you expect? Besides, I am not sure if <span style="color:rgb(34,34,34);font-family:arial,helvetica,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">`LoopAccessLegacyAnalysis::runOnFunction` does anything useful, have you check that, too?</span></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-08 1:49 GMT+08:00 Kewen Meng via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi LLVM community,<br>
<br>
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:<br>
<br>
// require pass<br>
virtual void getAnalysisUsage(AnalysisUsage &AU) const<br>
    {<br>
         AU.addRequired<<wbr>LoopInfoWrapperPass>();<br>
         AU.addRequired<<wbr>LoopAccessLegacyAnalysis>();<br>
         AU.setPreservesAll();<br>
    }<br>
<br>
// processing<br>
virtual bool runOnFunction(Function &F) {<br>
         LoopInfo &li = getAnalysis<<wbr>LoopInfoWrapperPass>().<wbr>getLoopInfo();<br>
         LoopAccessLegacyAnalysis &lala = getAnalysis<<wbr>LoopAccessLegacyAnalysis>();<br>
<br>
         for(LoopInfo::iterator lp = li.begin(); lp != li.end(); lp++)<br>
         {<br>
             Loop *loop = *lp;<br>
             const LoopAccessInfo &lai = lala.getInfo(loop);<br>
<br>
              // need help here<br>
              // I can’t get any information from the LoopAccessInfo instance.<br>
              errs()<<lai.getNumLoads(); // return 0<br>
          }<br>
}<br>
<br>
<br>
// register<br>
static RegisterPass<SkeletonPass> X("test", "test for using the existing pass",<br>
                                    “false",<br>
                                    “false”);<br>
<br>
<br>
I must be missing something important. Any response would be greatly appreciated!<br>
<br>
Thanks,<br>
Kewen<br>
<br>
<br>
<br>
<br>
Best regards,<br>
Kewen<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Wei-Ren Chen (陳韋任)<br>Homepage: <a href="https://people.cs.nctu.edu.tw/~chenwj" target="_blank">https://people.cs.nctu.edu.tw/~chenwj</a></div></div></div>
</div>