[LLVMdev] Separate loop condition and loop body
    Xinfinity 
    xinfinity_a at yahoo.com
       
    Tue May 11 02:01:12 PDT 2010
    
    
  
>>> 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).
>>
Consider break statements (CFG attached):
    while (j < 10 && j > 5 && j % 2 == 0) {
       j++;
       if (j == 9)
          break;
    }
In this example, block bb is in the loop body, has a successor not in  
the loop body, but is not building the condition. This appears to be a  
violation of your rule.
Trevor
Hi,
I agree that not all exiting blocks are part of the condition. 
Maybe your suggestion of trying a workaround would be easier. What I want is
to modify the structure of the loop by adding an extra condition before its
execution:
|------	extra.cond <-------|
|	     |		         |
|	     |		         |
|	     v		         |
|      |-loop.cond          |
|      |     |                   |
|      |     v	                 |
|      | CALL(body)  ___|
|      |
|      |---> loop.end
|
|____>exit
This condition has to be checked in the beginning of each iteration, that
means, the loop body should branch to this extra condition instead of the
loop condition. So I want to eliminate the branch from loop.body to
loop.cond and to insert a branch from loop.body to extra.cond .  Also, I
need to delimit the BBs building the body of the loop, in order to extract
them in a new function.
I hope my explanations are not too vague.
Thanks for your help.
Alexandra
 
-- 
View this message in context: http://old.nabble.com/Separate-loop-condition-and-loop-body-tp28512281p28521641.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
    
    
More information about the llvm-dev
mailing list