Take the following couple functions:
int f(int a)
{
  return (~a) != 0;
}

int f1(int a)
{
  return a != (~0);
}

int f2(int a)
{
  return (~a) != 1;
}

int f3(int a)
{
  return a != (~1);
}

f and f1 should be the same.  Likewise for f2 and f3.


-- 
           Summary: fold should convert ~a == C to a == ~C where C is a
                    constant
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org


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

Reply via email to