https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127103
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrea Pinski <[email protected]>: https://gcc.gnu.org/g:e548eb628c689e2836e570aef98b9547aff97a02 commit r17-4377-ge548eb628c689e2836e570aef98b9547aff97a02 Author: Andrea Pinski <[email protected]> Date: Fri Sep 11 13:32:39 2026 -0700 match: x+umax(x,1) -> umax(x*2, 1) [PR127103] This adds a simplification for `x+umax(x,1)` to `umax(x*2, 1)` when `x*2` is known not to overflow. This shows up with std::vector::push_back after the patch which adds `x+minmax(a,b)` simplification; it is also a special case of that patch for `umax and 1`. This gives a small code generation improvement with std::vector::push_back because we trade an add after the umax with a shift beforehand. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/127103 gcc/ChangeLog: * match.pd (`x+umax(x,1)`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/max1-plus-1.c: New test. Signed-off-by: Andrea Pinski <[email protected]>
