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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So the difference comes from the order. Before in phiopt we had:
-  /* Defer boolean x ? 0 : {1,-1} or x ? {1,-1} : 0 to
-     match_simplify_replacement.  */
-  if (TREE_CODE (TREE_TYPE (lhs)) == BOOLEAN_TYPE
-      && (integer_zerop (arg0)
-         || integer_zerop (arg1)
-         || TREE_CODE (TREE_TYPE (arg0)) == BOOLEAN_TYPE
-         || (TYPE_PRECISION (TREE_TYPE (arg0))
-             <= TYPE_PRECISION (TREE_TYPE (lhs)))))
-    return false;

But now the order is such that `?0:{1,-1}`, `?{1,-1}:0` is handled first.

So what we need to pattern match here is `(convert)zero_one_value_p@0!=0` and
simplify that into just (convert)@0

(for neeq (ne eq)
 (simplify
  (convert (neeq zero_one_value_p@0 integer_zerop))
  (if (neeq == NE_EXPR))
   (convert @0)
   (bit_xor (convert @0) { build_one_cst (type); } ))

Reply via email to