<div dir="ltr"><div>Hi,<br><br></div>I am trying to use the DependenceAnalysis pass to get the Distance vector for the innermost loop. I am in LLVM learing process. I have used the following code inside my original code to get the distance vector. It is not giving any syntax error but it is has some logical but and giving segmentation fault.<br><br>void getAnalysisUsage(AnalysisUsage &AU) const {<br>             AU.setPreservesAll();<br>      AU.addRequired<PostDominatorTree>();<br>      AU.addRequired<LoopInfo>();<br>      AU.addRequired<DependenceAnalysis>();<br>      AU.addPreserved<DependenceAnalysis>();<br>    AU.addRequired<ScalarEvolution>();<br>   AU.addPreserved<ScalarEvolution>();<br>  AU.addRequired<AliasAnalysis>();<br>   AU.addPreserved<AliasAnalysis>();<br>   AU.addRequired<MemoryDependenceAnalysis>();<br>   AU.addPreserved<MemoryDependenceAnalysis>();<br>           }<br><br>In runOnFunction I have used dependence = &getAnalysis<DependenceAnalysis>();<br>if(L->getSubLoops().size()==0)<br>            {    Dependence* dependence;<br>                const SCEV* scev = dependence->getDistance(loopID);<br>               ....<br>               ................ <br clear="all"><div><div>              .............<br>           }<br></div><div>loopID is and unsigned int variable which I have increased after each time after doing some other operations on loop like printing the basic block of each loop.<br><br></div><div>Is this the correct way to do it. Any example would be a great help for me to understand this. For a loop how can I print the distance vector using getDistance(). I have tried the da pass which worked fine for the example given in this <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__comments.gmane.org_gmane.comp.compilers.llvm.devel_55437&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=qQylmJlO7KBr1bWLPo0kow2CiegPX7dhwSWuMwIVd3Y&s=vrl-8n0v-s7TeSDdYauMvjD8mNPAR0MqB1TEILSFxgU&e=">http://comments.gmane.org/gmane.comp.compilers.llvm.devel/55437</a> link. please help.<br></div><div><br><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Thanks & Regards,<br>Manideepa Mukherjee<br>Contact No:- +91-7428062726</div></div></div>
</div></div></div>