https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110949
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:fa099f248e2462ecd5ab8b0cadd348aaf11bb093 commit r16-2392-gfa099f248e2462ecd5ab8b0cadd348aaf11bb093 Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Sun Jul 20 11:21:08 2025 -0700 match: Add `cmp - 1` simplification to `-icmp` [PR110949] I have seen this a few places though the testcase from PR 95906 is an obvious place where this shows up for sure. This convert `cmp - 1` into `-icmp` as that form is more useful in many cases. Changes since v1: * v2: Add check for outer type's precision being greater than 1. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/110949 PR tree-optimization/95906 gcc/ChangeLog: * match.pd (cmp - 1): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/cmp-2.c: New test. * gcc.dg/tree-ssa/max-bitcmp-1.c: New test. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>