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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
For -O1 we have:
  _24 = c_16 == 0;
  _6 = (int) _24;
  _2 = (short int) _24;
  _3 = (int) _24;
  _5 = e;
  _20 = _3 == _5;
  _21 = c_16 != 0;
  _22 = _20 & _21;

((c_16 == 0) == _5) & (c_16 != 0)
((!b) ? 0 : 1) == _5 & (b)
(c_16 != 0) & (0 == _5)

This fixes -O1 (which didn't work before):

(simplify
 (bit_and:c zero_one_valued_p@0 (eq:c @1 (convert @2)))
 (with { bool wascmp; }
  (if (bitwise_inverted_equal_p (@0, @2, wascmp))
   (bit_and @0 (eq @1 { build_zero_cst (TREE_TYPE (@1)); })))))

But -O2 is still broken.

Reply via email to