[LLVMdev] get basic blocks inside a loop

Michael Ilseman michael at lunarg.com
Mon May 9 09:56:18 PDT 2011


Whenever I was tying to do that (in version 2.8), it didn't give them
to me in a topological order. What I did, as a hack-ish temporary
measure, was rely on Function's ordering, and just iterated over all
the blocks in the function, checking to see if the loop contains that
block. Not at all ideal, and what I was writing later evolved to not
need the topological ordering constraint, so I never revisited the
problem. In hindsight, I don't even know if Function guarantees that
they are presented in a topological order, but it always happened to
be the case for me.


On Mon, May 9, 2011 at 10:45 AM, Naznin Fauzia <laboni14 at gmail.com> wrote:
> Hi all,
>
> I have a question about llvm::LoopBase  getBlocks() method. Does it return
> the basic blocks inside the loop in random order? I need to order the blocks
> in some valid topological ordering of the AST. If getBlocks() does not do
> that,  what can I do to find the ordering?
>
> Thanks,
> Naznin
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>




More information about the llvm-dev mailing list