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 <andrew.pinski@oss.qualcomm.com>
2 files changed