long condition( void );
long f1( void );
long f2( void );

void foo( void )
{
        for ( ;; )
                if ( condition() )
                        f1();
                else
                        f2();
}

foo() could be transformed to bar():

void bar( void )
{
        long (* f[ 2 ])() = { &f2, &f1 };
        for ( ;; )
                f[ condition() ]();
}


-- 
           Summary: missed loop-if transformation / branch reduction.
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net


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

Reply via email to