int f(int x, int y);
int g(int x, int z)
{
  int r;
  if (z == 0)
    r = f(x, 1);
  else
    r = f(x, 0);
  return r + 1;
}

could be optimized to 

  r = f(x, (z == 0 ? 1 : 0));

which would reduce the size of the generated code, and for
most targets allow further simplifications on the COND_EXPR
leading to branchless assembly.


-- 
           Summary: Missed optimization in ifcvt/crossjump
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rth at gcc dot gnu dot org


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

Reply via email to