[2/2] Remove is_gimple_condexpr

Message ID 20220516122051.D23FC13AAB@imap2.suse-dmz.suse.de
State Committed
Commit 19dd439389be2c5eb6b986d164760e061ba01938
Headers
Series [1/2] Force the selection operand of a GIMPLE COND_EXPR to be a register |

Commit Message

Richard Biener May 16, 2022, 12:20 p.m. UTC
  This removes is_gimple_condexpr, note the vectorizer via patterns
still creates COND_EXPRs with embedded GENERIC conditions and has
a reference to the function in comments.  Otherwise is_gimple_condexpr
is now equal to is_gimple_val.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2022-05-16  Richard Biener  <rguenther@suse.de>

	* gimple-expr.cc (is_gimple_condexpr): Remove.
	* gimple-expr.h (is_gimple_condexpr): Likewise.
	* gimplify.cc (gimplify_expr): Remove is_gimple_condexpr usage.
	* tree-if-conv.cc (set_bb_predicate): Likewie.
	(add_to_predicate_list): Likewise.
	(gen_phi_arg_condition): Likewise.
	(predicate_scalar_phi): Likewise.
	(predicate_statements): Likewise.
---
 gcc/gimple-expr.cc  | 11 -----------
 gcc/gimple-expr.h   |  1 -
 gcc/gimplify.cc     |  1 -
 gcc/tree-if-conv.cc | 33 ++++++++++++++-------------------
 4 files changed, 14 insertions(+), 32 deletions(-)
  

Patch

diff --git a/gcc/gimple-expr.cc b/gcc/gimple-expr.cc
index 09eac80ae1c..c9c7285efbc 100644
--- a/gcc/gimple-expr.cc
+++ b/gcc/gimple-expr.cc
@@ -614,17 +614,6 @@  is_gimple_condexpr_1 (tree t, bool allow_traps, bool allow_cplx)
 	      && is_gimple_val (TREE_OPERAND (t, 1))));
 }
 
-/* Return true if T is a condition operand in a GIMPLE assignment
-   with a COND_EXPR RHS.  */
-
-bool
-is_gimple_condexpr (tree t)
-{
-  /* Always split out _Complex type compares since complex lowering
-     doesn't handle this case.  */
-  return is_gimple_val (t);
-}
-
 /* Like is_gimple_condexpr, but does not allow T to trap.  */
 
 bool
diff --git a/gcc/gimple-expr.h b/gcc/gimple-expr.h
index ba53b808437..0c3ac096ed7 100644
--- a/gcc/gimple-expr.h
+++ b/gcc/gimple-expr.h
@@ -40,7 +40,6 @@  extern void extract_ops_from_tree (tree, enum tree_code *, tree *, tree *,
 extern void gimple_cond_get_ops_from_tree (tree, enum tree_code *, tree *,
 					   tree *);
 extern bool is_gimple_lvalue (tree);
-extern bool is_gimple_condexpr (tree);
 extern bool is_gimple_condexpr_for_cond (tree);
 extern bool is_gimple_address (const_tree);
 extern bool is_gimple_invariant_address (const_tree);
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 38e9d62535a..d4a0366a549 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -14951,7 +14951,6 @@  gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
     gcc_assert (fallback & (fb_rvalue | fb_lvalue));
   else if (gimple_test_f == is_gimple_val
            || gimple_test_f == is_gimple_call_addr
-           || gimple_test_f == is_gimple_condexpr
 	   || gimple_test_f == is_gimple_condexpr_for_cond
            || gimple_test_f == is_gimple_mem_rhs
            || gimple_test_f == is_gimple_mem_rhs_or_call
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 5b884aae3d6..2245b6bfd7c 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -244,8 +244,8 @@  static inline void
 set_bb_predicate (basic_block bb, tree cond)
 {
   gcc_assert ((TREE_CODE (cond) == TRUTH_NOT_EXPR
-	       && is_gimple_condexpr (TREE_OPERAND (cond, 0)))
-	      || is_gimple_condexpr (cond));
+	       && is_gimple_val (TREE_OPERAND (cond, 0)))
+	      || is_gimple_val (cond));
   ((struct bb_predicate *) bb->aux)->predicate = cond;
 }
 
@@ -544,10 +544,10 @@  add_to_predicate_list (class loop *loop, basic_block bb, tree nc)
     tp = &TREE_OPERAND (bc, 0);
   else
     tp = &bc;
-  if (!is_gimple_condexpr (*tp))
+  if (!is_gimple_val (*tp))
     {
       gimple_seq stmts;
-      *tp = force_gimple_operand_1 (*tp, &stmts, is_gimple_condexpr, NULL_TREE);
+      *tp = force_gimple_operand (*tp, &stmts, true, NULL_TREE);
       add_bb_predicate_gimplified_stmts (bb, stmts);
     }
   set_bb_predicate (bb, bc);
@@ -1884,16 +1884,14 @@  gen_phi_arg_condition (gphi *phi, vec<int> *occur,
 	  cond = c;
 	  break;
 	}
-      c = force_gimple_operand_gsi_1 (gsi, unshare_expr (c),
-				      is_gimple_condexpr, NULL_TREE,
-				      true, GSI_SAME_STMT);
+      c = force_gimple_operand_gsi (gsi, unshare_expr (c),
+				    true, NULL_TREE, true, GSI_SAME_STMT);
       if (cond != NULL_TREE)
 	{
 	  /* Must build OR expression.  */
 	  cond = fold_or_predicates (EXPR_LOCATION (c), c, cond);
-	  cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond),
-					     is_gimple_condexpr, NULL_TREE,
-					     true, GSI_SAME_STMT);
+	  cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true,
+					   NULL_TREE, true, GSI_SAME_STMT);
 	}
       else
 	cond = c;
@@ -1973,9 +1971,8 @@  predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi)
       else
 	cond = bb_predicate (first_edge->src);
       /* Gimplify the condition to a valid cond-expr conditonal operand.  */
-      cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond),
-					 is_gimple_condexpr, NULL_TREE,
-					 true, GSI_SAME_STMT);
+      cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true,
+				       NULL_TREE, true, GSI_SAME_STMT);
       true_bb = first_edge->src;
       if (EDGE_PRED (bb, 1)->src == true_bb)
 	{
@@ -2074,9 +2071,8 @@  predicate_scalar_phi (gphi *phi, gimple_stmt_iterator *gsi)
 	  cond = TREE_OPERAND (cond, 0);
 	}
       /* Gimplify the condition to a valid cond-expr conditonal operand.  */
-      cond = force_gimple_operand_gsi_1 (gsi, unshare_expr (cond),
-					 is_gimple_condexpr, NULL_TREE,
-					 true, GSI_SAME_STMT);
+      cond = force_gimple_operand_gsi (gsi, unshare_expr (cond), true,
+				       NULL_TREE, true, GSI_SAME_STMT);
       if (!(is_cond_scalar_reduction (phi, &reduc, arg0 , arg1,
 				      &op0, &op1, true, &has_nop, &nop_reduc)))
 	rhs = fold_build_cond_expr (TREE_TYPE (res), unshare_expr (cond),
@@ -2612,9 +2608,8 @@  predicate_statements (loop_p loop)
 	      rhs = ifc_temp_var (type, unshare_expr (rhs), &gsi);
 	      if (swap)
 		std::swap (lhs, rhs);
-	      cond = force_gimple_operand_gsi_1 (&gsi, unshare_expr (cond),
-						 is_gimple_condexpr, NULL_TREE,
-						 true, GSI_SAME_STMT);
+	      cond = force_gimple_operand_gsi (&gsi, unshare_expr (cond), true,
+					       NULL_TREE, true, GSI_SAME_STMT);
 	      rhs = fold_build_cond_expr (type, unshare_expr (cond), rhs, lhs);
 	      gimple_assign_set_rhs1 (stmt, ifc_temp_var (type, rhs, &gsi));
 	      update_stmt (stmt);