https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111331
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs-bisection | --- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Fix for the trunk -O0 issue: ``` diff --git a/gcc/match.pd b/gcc/match.pd index 8c24dae71cd..f67bb9c12e7 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -5435,6 +5435,16 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (with { tree_code code = minmax_from_comparison (cmp, @0, @1, @0, @4); + /* For LT and GT, @4 and @1 needs to be the same.\ + For an example: + _3 > 28 ? MIN_EXPR <_3, 28> : 29 + is not the same as + MAX_EXPR <MIN_EXPR <_3, 28>, 29> + But `_3 >= 28` would be. */ + if (cmp != LE_EXPR + && cmp != GE_EXPR + && !operand_equal_p (@1, @4)) + code = ERROR_MARK; } (if ((cmp == LT_EXPR || cmp == LE_EXPR) && code == MIN_EXPR ``` But we still fail the original testcase at -O1 because the code in phiopt is still needs to be fixed ...