For the testcase

int foo(int i, int j)
{
  return (i < j) == (j > i);
}

fold does not fold the expression to 1, but instead to
  i < j ^ j > i
which should be done as a last resort only.  fold_comparison does not
handle the original tree either, nor does operand_equal_p see that both
operands of the EQ_EXPR are "equal".


-- 
           Summary: Fold does not fold i < j == j > i to 1
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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

Reply via email to