>From 7f4b5962498bab83983f77da8969de9a70e893c1 Mon Sep 17 00:00:00 2001
From: Kael Andrew Alonzo Franco <[email protected]>
Date: Fri, 17 Jul 2026 10:34:46 -0400
Subject: [PATCH] match: Move tree_expr_nonnegative_p (@1) to
tree_expr_nonnegative_p@1. [PR126087]

This simplify r17-2487.

Bootstrapped and tested on x86_64-pc-linux-gnu.

        PR tree-optimization/126087

gcc/ChangeLog:

        * match.pd: Move tree_expr_nonnegative_p (@1) to
tree_expr_nonnegative_p@1. [PR126087]

Signed-off-by: Kael Andrew Franco <[email protected]>
---
 gcc/match.pd | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index a5870dae46b..07b3f72d73b 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -4847,9 +4847,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 (for op (min bit_ior)
   (for cmp (ge lt)
     (simplify
-      (cmp (op:c @0 @1) integer_zerop@2)
-      (if (tree_expr_nonnegative_p (@1))
-        (cmp @0 @2)))))
+      (cmp (op:c @0 tree_expr_nonnegative_p@1) integer_zerop@2)
+        (cmp @0 @2))))

 /* Undo fancy ways of writing max/min or other ?: expressions, like
    a - ((a - b) & -(a < b))  and  a - (a - b) * (a < b) into (a < b) ? b : a.
-- 
2.55.0

Reply via email to