https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70170
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- I think that to fix this, we need to add a new pattern to match.pd that deals with "(ptr +p off) !=/== 0B". Thus something like: --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2263,6 +2263,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (simplify (cmp (convert? addr@0) integer_zerop) (if (tree_single_nonzero_warnv_p (@0, NULL)) + { constant_boolean_node (cmp == NE_EXPR, type); })) + + (simplify + (cmp (pointer_plus (convert? @0) INTEGER_CST@1) integer_zerop) + (if (tree_single_nonzero_warnv_p (@0, NULL)) { constant_boolean_node (cmp == NE_EXPR, type); }))) /* If we have (A & C) == C where C is a power of 2, convert this into