[Bug tree-optimization/54742] Switch elimination in FSM loop

venkataramanan.kumar at amd dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 4 08:34:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54742

--- Comment #6 from Venkataramanan <venkataramanan.kumar at amd dot com> 2013-03-04 08:34:06 UTC ---
(In reply to comment #5)

> int first;
> void thread_backedge (void)
> {
>   int i = 0;
> 
>   do
>     {
>       if (first ==1)
>       {
>           foo ();
>           first=0;
>       }
>      else
>      {
>        bla ();
>       first =0;
>      }
> 
>     } while (i++ < 100);
> }

Can be jump threaded 

if (first ==1)
{
    foo();
}
else
{
L1:
   bla()
}

first =0

i++
if i<=99 goto L1
else return.



More information about the Gcc-bugs mailing list