[LLVMdev] Separate loop condition and loop body

Trevor Harmon trevor.w.harmon at nasa.gov
Mon May 10 12:32:06 PDT 2010


On May 10, 2010, at 11:35 AM, Benoit Boissinot wrote:

> To me it looks like any basic block from the loop body with a
> successor not in the loop body is a BB "building the condition" (an
> "exit" block).

I assume you mean "any basic block from the loop header".

I don't think your rule will work. Consider this counterexample:

    while (j < 10 && j > 5 && j % 2 == 0) {
       j++;
    }

This will give you the attached CFG. bb1 is the loop header; bb2 and  
bb3 are the other loop conditionals; bb is the loop body.

Note that bb3 is part of the condition but is not a basic block from  
the loop header.

Trevor

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cfg._Z6simplei.dot
Type: application/octet-stream
Size: 2002 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100510/2b9c3c70/attachment.obj>
-------------- next part --------------



More information about the llvm-dev mailing list