[LLVMdev] Loop Dependence Analysis(getDistance())

Jake VanAdrighem jvanadrighem at gmail.com
Wed Jul 29 09:11:30 PDT 2015


In the example you provided, the author uses the DependenceAnalysis to
retrieve a dependence for the src and dest instructions. Note the
line: dependenceAnalysis->depends(instructions[src],
instructions[dst], true);
Without really exploring much I think you should note that getDistance is a
function of the Dependence class and not DependenceAnalysis. You need to
retrieve a dependence or dependencies to operate with getDistance. In your
code you're just pulling the Analysis information and immediately
attempting to retrieve the distance.
It might help to take a look at how DependenceAnalysis and getDistance are
used in:

lib/Transforms/Scalar/LoopInterchange.cpp

Jake



On Tue, Jul 28, 2015 at 11:42 PM, Manideepa Mukherjee <
manideepa.mukherjee at gmail.com> wrote:

> Hi,
>
> 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.
>
> void getAnalysisUsage(AnalysisUsage &AU) const {
>              AU.setPreservesAll();
>       AU.addRequired<PostDominatorTree>();
>       AU.addRequired<LoopInfo>();
>       AU.addRequired<DependenceAnalysis>();
>       AU.addPreserved<DependenceAnalysis>();
>     AU.addRequired<ScalarEvolution>();
>    AU.addPreserved<ScalarEvolution>();
>   AU.addRequired<AliasAnalysis>();
>    AU.addPreserved<AliasAnalysis>();
>    AU.addRequired<MemoryDependenceAnalysis>();
>    AU.addPreserved<MemoryDependenceAnalysis>();
>            }
>
> In runOnFunction I have used dependence =
> &getAnalysis<DependenceAnalysis>();
> if(L->getSubLoops().size()==0)
>             {    Dependence* dependence;
>                 const SCEV* scev = dependence->getDistance(loopID);
>                ....
>                ................
>               .............
>            }
> 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.
>
> 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
> http://comments.gmane.org/gmane.comp.compilers.llvm.devel/55437
> <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=>
> link. please help.
>
>
> --
> Thanks & Regards,
> Manideepa Mukherjee
> Contact No:- +91-7428062726
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150729/5d4e37cc/attachment.html>


More information about the llvm-dev mailing list