https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127102
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Naveen H.S <[email protected]>: https://gcc.gnu.org/g:09fe63bb71e6b14186b0bb1f910270be101a6385 commit r17-3779-g09fe63bb71e6b14186b0bb1f910270be101a6385 Author: Naveen <[email protected]> Date: Sun Aug 30 21:54:33 2026 -0700 tree-optimization: Simplify MIN(A, B) eq/ne 0 to A when B is positive [PR127102] GCC does not fold comparisons of the form MIN(A, B) == 0 or MIN(A, B) != 0 to A == 0 / A != 0 when one of the MIN operands is known to be positive. The pattern uses min:c so it handles both MIN(A, B) and MIN(B, A) by symmetry. The INTEGRAL_TYPE_P guard keeps it consistent with the surrounding patterns and avoids applying it to pointer or non-integer types where the nonneg/nonzero predicates have different semantics. gcc/ChangeLog PR tree-optimization/127102 * match.pd: Add pattern to simplify MIN(A,B) == 0 to A == 0 and MIN(A,B) != 0 to A != 0 when B is known positive. gcc/testsuite/ChangeLog PR tree-optimization/127102 * gcc.dg/tree-ssa/pr127102.c: New test. Signed-off-by: Naveen <[email protected]>
