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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Mital Ashok from comment #0)
> Because the function is equivalent to `return x + 1u;`. This optimisation is
> done for `return x == 0u ? 1u : x + 1u;`.

That is handled by:
/* ?: Value replacement. */
/* a == 0 ? b : b + a  -> b + a */
(for op (plus bit_ior bit_xor)
 (simplify
  (cond (eq @0 integer_zerop) @1 (op:c@2 @1 @0))
   @2))

Reply via email to