[LLVMdev] determining the number of iteration of a loop

khaled hamidouche khaledhamidouche at gmail.com
Wed Apr 21 07:31:22 PDT 2010


I'm wandring to know how many times a block is executed inside a loop  ?
knowing that I can't use  getSmallConstantTripCount() because the number is
unkown  "for (i=0;i<N;i++)  for example"

I'm using a Function pass

for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
    if (Loop *L = LI->getLoopFor(BB)) {
            if (L->getHeader() == BB)
                 the code of the loop   (the header)
             else{the code of the block inside the loop}
     the code of a basicblock (outside a loop)

How can I get the variable N (even only the name of this variable !!)   ???

I mean I want to get  "the loop will be executed  "%N"  times"

Thank you so much

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100421/59c92f33/attachment.html>

More information about the llvm-dev mailing list