]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Slightly improve bitwise_inverted_equal_p comparisons
authorAndrew Pinski <apinski@marvell.com>
Sat, 29 Jul 2023 23:29:09 +0000 (16:29 -0700)
committerAndrew Pinski <apinski@marvell.com>
Wed, 2 Aug 2023 08:08:31 +0000 (01:08 -0700)
This slighly improves bitwise_inverted_equal_p
for comparisons. Instead of just comparing the
comparisons operands also valueize them.
This will allow ccp and others to match the 2 comparisons
without an extra pass happening.

OK? Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* gimple-match-head.cc (gimple_bitwise_inverted_equal_p): Valueize
the comparison operands before comparing them.

gcc/gimple-match-head.cc

index 0265e55be93f584f1e9c374cf57cae5bd1df9f11..b1e96304d7c3b2198a633546c927e4aebb5e66c5 100644 (file)
@@ -319,12 +319,12 @@ gimple_bitwise_inverted_equal_p (tree expr1, tree expr2, tree (*valueize) (tree)
       && TREE_CODE_CLASS (gimple_assign_rhs_code (a1)) == tcc_comparison
       && TREE_CODE_CLASS (gimple_assign_rhs_code (a2)) == tcc_comparison)
     {
-      tree op10 = gimple_assign_rhs1 (a1);
-      tree op20 = gimple_assign_rhs1 (a2);
+      tree op10 = do_valueize (valueize, gimple_assign_rhs1 (a1));
+      tree op20 = do_valueize (valueize, gimple_assign_rhs1 (a2));
       if (!operand_equal_p (op10, op20))
         return false;
-      tree op11 = gimple_assign_rhs2 (a1);
-      tree op21 = gimple_assign_rhs2 (a2);
+      tree op11 = do_valueize (valueize, gimple_assign_rhs2 (a1));
+      tree op21 = do_valueize (valueize, gimple_assign_rhs2 (a2));
       if (!operand_equal_p (op11, op21))
         return false;
       if (invert_tree_comparison (gimple_assign_rhs_code (a1),