This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

CFG transformation of loops with continue statement inside the loops.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]