[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-16 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #12 from Richard Biener --- (In reply to Andrew Pinski from comment #10) > (In reply to Andrew Pinski from comment #9) > > So the easy workaround is not use tree_expr_nonnegative_p as predicate here > > and just do: > > ``` > > (sim

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-16 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #11 from Richard Biener --- Well, the issue is that tree_expr_nonnegative_p does not honor no_follow_ssa_edges in static bool cleanup_control_expr_graph (basic_block bb, gimple_stmt_iterator gsi) { ... switch (gimple_code (stm

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-15 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #10 from Andrew Pinski --- (In reply to Andrew Pinski from comment #9) > So the easy workaround is not use tree_expr_nonnegative_p as predicate here > and just do: > ``` > (simplify > (cmp @0 zerop@1) > (if (tree_expr_nonnegativ

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-15 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #9 from Andrew Pinski --- Replaced redundant PHI node defining c_3 with c_6 Replaced redundant PHI node defining b_13 with 0 Removing unexecutable edge from if (b_13 != 0) Removing dead stmt b_13 = PHI <0(3)> Removing dead stmt c_3

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-15 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 Andrew Pinski changed: What|Removed |Added Attachment #61434|0 |1 is obsolete|

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-15 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #7 from Andrew Pinski --- Created attachment 61434 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61434&action=edit Reduced testcase This is the reduced testcase for running into the ICE issue with the patch.

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-15 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #6 from Andrew Pinski --- Created attachment 61433 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61433&action=edit testcase ``` t.cc:14:1: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (error_

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #5 from Andrew Pinski --- Created attachment 61427 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61427&action=edit Patch which I am testing

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #4 from Andrew Pinski --- ``` diff --git a/gcc/match.pd b/gcc/match.pd index 79485f9678a..7b2cad9d605 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2598,6 +2598,15 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) ) ) +/* Convert ABS_EX

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #3 from Andrew Pinski --- The full list of failures due to this missing optimization: gcc.dg/tree-ssa/vrp12.c gcc.dg/tree-ssa/vrp60.c gcc.dg/tree-ssa/pr20139.c

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 --- Comment #2 from Andrew Pinski --- fold_binary_loc does: ``` /* Convert ABS_EXPR >= 0 to true. */ strict_overflow_p = false; if (code == GE_EXPR && (integer_zerop (arg1) || (! HONOR_NANS (arg0)

[Bug tree-optimization/120280] ABS < 0 is not optimized to false by match

2025-05-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120280 Andrew Pinski changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED