[LLVMdev] loop detection

John Criswell criswell at illinois.edu
Tue Jul 24 07:39:48 PDT 2012


On 7/23/12 7:04 PM, Edvard Ghazaryan wrote:
>
>
> Hello .
>
> I'm trying to implement FunctionPass for detecting loops in llvm IR.

I think the LoopInfo analysis already locates loops.

> How can I get <condition> for loop from llvm::Loop object.?
> Is there any example?
>

I think one way to do this is to use the PostDominator pass to compute 
control-dependences for the loop and then find which basic block(s) are 
dependences for the loop entry basic block.  The condition variable 
should be an argument to the terminator instruction of the basic block 
on which the loop entry block depends.

-- John T.

> Thanks in advance,
> Edvard
>
>
>
>
>
>
> _______________________________________________
> 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/20120724/5ef4552f/attachment.html>


More information about the llvm-dev mailing list