[Bug tree-optimization/101024] Missed min expression at phiopt1
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Oct 23 16:10:26 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101024
--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:22448c7f647d03d8b2727a3e1601aa4078ad87b6
commit r16-4583-g22448c7f647d03d8b2727a3e1601aa4078ad87b6
Author: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Date: Mon Oct 20 22:45:47 2025 -0700
match: Add support for `((signed)a </>= 0) ? min/max (a, c) : b` [PR101024]
This is the last patch that is needed to support to remove
minmax_replacement.
This fixes pr101024-1.c which is failing when minmax_replacement is
removed.
This next patch will remove it.
Changes since v1:
* v2: Add new version of minmax_from_comparison that takes widest_int.
Constraint the pattern to constant integers in some cases.
Use mask to create the SIGNED_MAX and use GT/LE instead.
Use wi::le_p/wi::ge_p instead of fold_build to do the comparison.
gcc/ChangeLog:
PR tree-optimization/101024
* fold-const.cc (minmax_from_comparison): New version that takes
widest_int
instead of tree.
(minmax_from_comparison): Call minmax_from_comparison for integer
cst case.
* fold-const.h (minmax_from_comparison): New declaration.
* match.pd (`((signed)a </>= 0) ? min/max (a, c) : b`): New
pattern.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
More information about the Gcc-bugs
mailing list