GCC does this match.pd. Here's the add_zero example, I think:
/* Simplifications of operations with one constant operand and
simplifications to constants or single values. */
(for op (plus pointer_plus minus bit_ior bit_xor)
(simplify
(op @0 integer_zerop)
(non_lvalue @0)))
The floating point case can be more complicated because of signed zeros and signaling NaNs, see fold_real_zero_addition_p.