These two functions should produce the same asm but they don't:
int f(int t, int a, int b)
{
  int c, d;
  if (t)
  {
    c = a;
    d = a;
  }
  else
  {
    c = b;
    d = b;
  }
  return c+d;
}

int f1(int t, int a, int b)
{
  int c;
  c = t?a:b;
  return c+c;
}

----------------
f1 is better optimized because it has less register pressure than f.
Note this was reduced from a problem in PR23305.


-- 
           Summary: Not elimintation the PHIs which have the same agruments
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
OtherBugsDependingO 23305
             nThis:


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

Reply via email to