[LLVMdev] Loop Dependence Analysis(getDistance())

Manideepa Mukherjee manideepa.mukherjee at gmail.com
Tue Jul 28 23:42:03 PDT 2015


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 link.
please help.


-- 
Thanks & Regards,
Manideepa Mukherjee
Contact No:- +91-7428062726
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150729/3dfb149a/attachment.html>


More information about the llvm-dev mailing list