[gcc r17-2734] match: Combine two for into one for.

Kael Andrew Franco via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:50de8811e42ce019ec97e10c06469259d55d63de

commit r17-2734-g50de8811e42ce019ec97e10c06469259d55d63de
Author: Kael Andrew Alonzo Franco <[email protected]>
Date:   Mon Jul 27 16:40:56 2026 -0400

    match: Combine two for into one for.
    
    This simplifies r5-4683, r5-4899, and r6-2617.
    
    Bootstrapped and regtested on x86_64-pc-linux-gnu.
    
    gcc/ChangeLog:
    
            * match.pd: Combine two for into one for.
    
    Signed-off-by: Kael Andrew Franco <[email protected]>

Diff:
---
 gcc/match.pd | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 536d5125a0b6..62d080931253 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2514,16 +2514,12 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 (simplify
  (bit_and:c @0 (logical_inverted_value @0))
  { build_zero_cst (type); })
-/* X | !X and X ^ !X -> 1, , if X is truth-valued.  */
-(for op (bit_ior bit_xor)
- (simplify
-  (op:c truth_valued_p@0 (logical_inverted_value @0))
-  { constant_boolean_node (true, type); }))
-/* X ==/!= !X is false/true.  */
-(for op (eq ne)
+/* X | !X and X ^ !X -> 1, , if X is truth-valued.
+   X ==/!= !X is false/true.  */
+(for op (bit_ior bit_xor eq ne)
  (simplify
   (op:c truth_valued_p@0 (logical_inverted_value @0))
-  { constant_boolean_node (op == NE_EXPR ? true : false, type); }))
+  { constant_boolean_node (op == EQ_EXPR ? false : true, type); }))
 
 /* ~~x -> x */
 (simplify
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.