https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82062

--- Comment #9 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> There are two things to it, stripping sign-nops from the comparison
> operand (careful!) and stripping arbitrary nops from the result
> to look for an argument equal to the comparison operand.

My change doesn't add any stripping, it only does:

  if (TREE_CODE (arg1) == NOP_EXPR
      && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0))
    return true;

on the unstripped operands, i.e. it only adds back a simplified version of the
second test removed by Marek's change; it's independent of the first test.

> Maybe refactor operand_equal_for_comparison_p into sth
> that does not strip arg0 at all but leave that to the caller.

The caller doesn't really want to strip arg0 either:

  /* Strip any conversions that don't change the mode.  This is safe
     for every expression, except for a comparison expression because
     its signedness is derived from its operands.  So, in the latter
     case, only strip conversions that don't change the signedness.

In fact it doesn't strip it at all, which is probably good.

Reply via email to