Remove is_gimple_condexpr
authorRichard Biener <rguenther@suse.de>
Thu, 12 May 2022 13:26:22 +0000 (15:26 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 23 May 2022 09:30:39 +0000 (11:30 +0200)
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.

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
gcc/gimple-expr.h
gcc/gimplify.cc
gcc/tree-if-conv.cc

index 09eac80..c9c7285 100644 (file)
@@ -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
index ba53b80..0c3ac09 100644 (file)
@@ -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);
index 2b92b63..98f5544 100644 (file)
@@ -15023,7 +15023,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
index 5b884aa..2245b6b 100644 (file)
@@ -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);