From ee20be8325f7f257ba91a0201cfb3bd6bfbceba9 Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Sat, 29 Jul 2023 16:29:09 -0700 Subject: [PATCH] Slightly improve bitwise_inverted_equal_p comparisons 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/gimple-match-head.cc b/gcc/gimple-match-head.cc index 0265e55be93f..b1e96304d7c3 100644 --- a/gcc/gimple-match-head.cc +++ b/gcc/gimple-match-head.cc @@ -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), -- 2.47.2