CFG transformation of loops with continue statement inside the loops.

Ajit Kumar Agarwal ajit.kumar.agarwal@xilinx.com
Wed Jul 8 14:46:00 GMT 2015


All:

While/For ( condition1)
{
   Some code here.
  If(condition2 )
    continue;
  Some code here.
}

Fig(1)

For the above loop in Fig(1)  there will be two backedges and multiple latches.  The below code can be transformed to the below in order to 
have a single backedge.

While/For (condition1)
{
   Some code here.
   If( condition2)
     Goto latch;
  Some code here.

Latch:
}

Fig(2).

With the transformation shown in Fig(2) the presence of GoTo inside loops  affect and disables many  optimizations. To enable
the loops in Fig(1) can also be transformed to multiple loops with each backedge that will make the affected optimizations enabled 
and the transformed Multiple loops will  enable many optimizations that are disabled with the presence of GoTo in Fig(2) and multiple
latches given in Fig(1).

Thoughts?

Thanks & Regards
Ajit



More information about the Gcc mailing list