[Bug tree-optimization/19827] New: Missed pure/const optimization

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Feb 9 03:09:00 GMT 2005


The following two function should produce the same asm because we can skip the second call to f:
int f(void) __attribute__((const,pure));

int g(int i, int j)
{
  int k = 0;
  if(i)
    k = f();
  if (j)
    k = f();
  return k;
}
int h(int i, int j)
{
  int k = 0;
  if(i)
    k = f();
  else if (j)
    k = f();
  return k;
}

-- 
           Summary: Missed pure/const optimization
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list