https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123286
--- Comment #9 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:b20f5c7760e4c5032e8f9d84145d3be7d0238029 commit r17-459-gb20f5c7760e4c5032e8f9d84145d3be7d0238029 Author: Naveen <[email protected]> Date: Mon May 11 21:08:11 2026 -0700 tree-optimization: Fold SAT_ADD at gimple level Extend scalar SAT_ADD constant folding to recognize cases where one operand is zero. It allows SAT_ADD expressions with constant operands to fold away early. The change improves optimization opportunities and avoids emitting unnecessary SAT_ADD operations. Bootstrapped and tested on aarch64-linux-gnu. PR middle-end/123286 gcc/ChangeLog: * fold-const-call.cc (fold_internal_fn_sat_add): New function. (fold_const_call): Handle CFN_SAT_ADD. * match.pd: Add simplifications for x SAT_ADD 0 == x. * genmatch.cc (commutative_op): Add CFN_SAT_ADD. gcc/testsuite/ChangeLog: * gcc.dg/pr123286.c: New test. Signed-off-by: Naveen <[email protected]>
