Re: [PATCH] Remove ASSERT_EXPR.
On Tue, Nov 22, 2022 at 2:58 PM Aldy Hernandez wrote: > > This removes all uses of ASSERT_EXPR except the internal one in ipa-*. > > OK pending tests? OK. > gcc/ChangeLog: > > * doc/gimple.texi: Remove ASSERT_EXPR references. > * fold-const.cc (tree_expr_nonzero_warnv_p): Same. > (fold_binary_loc): Same. > (tree_expr_nonnegative_warnv_p): Same. > * gimple-array-bounds.cc (get_base_decl): Same. > * gimple-pretty-print.cc (dump_unary_rhs): Same. > * gimple.cc (get_gimple_rhs_num_ops): Same. > * pointer-query.cc (handle_ssa_name): Same. > * tree-cfg.cc (verify_gimple_assign_single): Same. > * tree-pretty-print.cc (dump_generic_node): Same. > * tree-scalar-evolution.cc (scev_dfs::follow_ssa_edge_expr):Same. > (interpret_rhs_expr): Same. > * tree-ssa-operands.cc (operands_scanner::get_expr_operands): Same. > * tree-ssa-propagate.cc > (substitute_and_fold_dom_walker::before_dom_children): Same. > * tree-ssa-threadedge.cc: Same. > * tree-vrp.cc (overflow_comparison_p): Same. > * tree.def (ASSERT_EXPR): Add note. > * tree.h (ASSERT_EXPR_VAR): Remove. > (ASSERT_EXPR_COND): Remove. > * vr-values.cc (simplify_using_ranges::vrp_visit_cond_stmt): > Remove comment. > --- > gcc/doc/gimple.texi | 3 +-- > gcc/fold-const.cc| 6 - > gcc/gimple-array-bounds.cc | 9 +--- > gcc/gimple-pretty-print.cc | 1 - > gcc/gimple.cc| 1 - > gcc/pointer-query.cc | 6 - > gcc/tree-cfg.cc | 11 - > gcc/tree-pretty-print.cc | 8 --- > gcc/tree-scalar-evolution.cc | 15 - > gcc/tree-ssa-operands.cc | 1 - > gcc/tree-ssa-propagate.cc| 5 + > gcc/tree-ssa-threadedge.cc | 6 ++--- > gcc/tree-vrp.cc | 7 +++--- > gcc/tree.def | 5 - > gcc/tree.h | 4 > gcc/vr-values.cc | 43 > 16 files changed, 13 insertions(+), 118 deletions(-) > > diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi > index 7832fa6ff90..a4263922887 100644 > --- a/gcc/doc/gimple.texi > +++ b/gcc/doc/gimple.texi > @@ -682,8 +682,7 @@ more than two slots on the RHS. For instance, a > @code{COND_EXPR} > expression of the form @code{(a op b) ? x : y} could be flattened > out on the operand vector using 4 slots, but it would also > require additional processing to distinguish @code{c = a op b} > -from @code{c = a op b ? x : y}. Something similar occurs with > -@code{ASSERT_EXPR}. In time, these special case tree > +from @code{c = a op b ? x : y}. In time, these special case tree > expressions should be flattened into the operand vector. > @end itemize > > diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc > index b89cac91cae..114258fa182 100644 > --- a/gcc/fold-const.cc > +++ b/gcc/fold-const.cc > @@ -10751,7 +10751,6 @@ tree_expr_nonzero_warnv_p (tree t, bool > *strict_overflow_p) > case COND_EXPR: > case CONSTRUCTOR: > case OBJ_TYPE_REF: > -case ASSERT_EXPR: > case ADDR_EXPR: > case WITH_SIZE_EXPR: > case SSA_NAME: > @@ -12618,10 +12617,6 @@ fold_binary_loc (location_t loc, enum tree_code > code, tree type, > : fold_convert_loc (loc, type, arg1); >return tem; > > -case ASSERT_EXPR: > - /* An ASSERT_EXPR should never be passed to fold_binary. */ > - gcc_unreachable (); > - > default: >return NULL_TREE; > } /* switch (code) */ > @@ -15117,7 +15112,6 @@ tree_expr_nonnegative_warnv_p (tree t, bool > *strict_overflow_p, int depth) > case COND_EXPR: > case CONSTRUCTOR: > case OBJ_TYPE_REF: > -case ASSERT_EXPR: > case ADDR_EXPR: > case WITH_SIZE_EXPR: > case SSA_NAME: > diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc > index 1eafd3fd3e1..eae49ab3910 100644 > --- a/gcc/gimple-array-bounds.cc > +++ b/gcc/gimple-array-bounds.cc > @@ -75,14 +75,7 @@ get_base_decl (tree ref) >if (gimple_assign_single_p (def)) > { > base = gimple_assign_rhs1 (def); > - if (TREE_CODE (base) != ASSERT_EXPR) > - return base; > - > - base = TREE_OPERAND (base, 0); > - if (TREE_CODE (base) != SSA_NAME) > - return base; > - > - continue; > + return base; > } > >if (!gimple_nop_p (def)) > diff --git a/gcc/gimple-pretty-print.cc b/gcc/gimple-pretty-print.cc > index 7ec079f15c6..af704257633 100644 > --- a/gcc/gimple-pretty-print.cc > +++ b/gcc/gimple-pretty-print.cc > @@ -339,7 +339,6 @@ dump_unary_rhs (pretty_printer *buffer, const gassign > *gs, int spc, >switch (rhs_code) > { > case VIEW_CONVERT_EXPR: > -case ASSERT_EXPR: >dump_generic_node (buffer, rhs, spc, flags, false); >break; > > diff --git
[PATCH] Remove ASSERT_EXPR.
This removes all uses of ASSERT_EXPR except the internal one in ipa-*. OK pending tests? gcc/ChangeLog: * doc/gimple.texi: Remove ASSERT_EXPR references. * fold-const.cc (tree_expr_nonzero_warnv_p): Same. (fold_binary_loc): Same. (tree_expr_nonnegative_warnv_p): Same. * gimple-array-bounds.cc (get_base_decl): Same. * gimple-pretty-print.cc (dump_unary_rhs): Same. * gimple.cc (get_gimple_rhs_num_ops): Same. * pointer-query.cc (handle_ssa_name): Same. * tree-cfg.cc (verify_gimple_assign_single): Same. * tree-pretty-print.cc (dump_generic_node): Same. * tree-scalar-evolution.cc (scev_dfs::follow_ssa_edge_expr):Same. (interpret_rhs_expr): Same. * tree-ssa-operands.cc (operands_scanner::get_expr_operands): Same. * tree-ssa-propagate.cc (substitute_and_fold_dom_walker::before_dom_children): Same. * tree-ssa-threadedge.cc: Same. * tree-vrp.cc (overflow_comparison_p): Same. * tree.def (ASSERT_EXPR): Add note. * tree.h (ASSERT_EXPR_VAR): Remove. (ASSERT_EXPR_COND): Remove. * vr-values.cc (simplify_using_ranges::vrp_visit_cond_stmt): Remove comment. --- gcc/doc/gimple.texi | 3 +-- gcc/fold-const.cc| 6 - gcc/gimple-array-bounds.cc | 9 +--- gcc/gimple-pretty-print.cc | 1 - gcc/gimple.cc| 1 - gcc/pointer-query.cc | 6 - gcc/tree-cfg.cc | 11 - gcc/tree-pretty-print.cc | 8 --- gcc/tree-scalar-evolution.cc | 15 - gcc/tree-ssa-operands.cc | 1 - gcc/tree-ssa-propagate.cc| 5 + gcc/tree-ssa-threadedge.cc | 6 ++--- gcc/tree-vrp.cc | 7 +++--- gcc/tree.def | 5 - gcc/tree.h | 4 gcc/vr-values.cc | 43 16 files changed, 13 insertions(+), 118 deletions(-) diff --git a/gcc/doc/gimple.texi b/gcc/doc/gimple.texi index 7832fa6ff90..a4263922887 100644 --- a/gcc/doc/gimple.texi +++ b/gcc/doc/gimple.texi @@ -682,8 +682,7 @@ more than two slots on the RHS. For instance, a @code{COND_EXPR} expression of the form @code{(a op b) ? x : y} could be flattened out on the operand vector using 4 slots, but it would also require additional processing to distinguish @code{c = a op b} -from @code{c = a op b ? x : y}. Something similar occurs with -@code{ASSERT_EXPR}. In time, these special case tree +from @code{c = a op b ? x : y}. In time, these special case tree expressions should be flattened into the operand vector. @end itemize diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index b89cac91cae..114258fa182 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -10751,7 +10751,6 @@ tree_expr_nonzero_warnv_p (tree t, bool *strict_overflow_p) case COND_EXPR: case CONSTRUCTOR: case OBJ_TYPE_REF: -case ASSERT_EXPR: case ADDR_EXPR: case WITH_SIZE_EXPR: case SSA_NAME: @@ -12618,10 +12617,6 @@ fold_binary_loc (location_t loc, enum tree_code code, tree type, : fold_convert_loc (loc, type, arg1); return tem; -case ASSERT_EXPR: - /* An ASSERT_EXPR should never be passed to fold_binary. */ - gcc_unreachable (); - default: return NULL_TREE; } /* switch (code) */ @@ -15117,7 +15112,6 @@ tree_expr_nonnegative_warnv_p (tree t, bool *strict_overflow_p, int depth) case COND_EXPR: case CONSTRUCTOR: case OBJ_TYPE_REF: -case ASSERT_EXPR: case ADDR_EXPR: case WITH_SIZE_EXPR: case SSA_NAME: diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc index 1eafd3fd3e1..eae49ab3910 100644 --- a/gcc/gimple-array-bounds.cc +++ b/gcc/gimple-array-bounds.cc @@ -75,14 +75,7 @@ get_base_decl (tree ref) if (gimple_assign_single_p (def)) { base = gimple_assign_rhs1 (def); - if (TREE_CODE (base) != ASSERT_EXPR) - return base; - - base = TREE_OPERAND (base, 0); - if (TREE_CODE (base) != SSA_NAME) - return base; - - continue; + return base; } if (!gimple_nop_p (def)) diff --git a/gcc/gimple-pretty-print.cc b/gcc/gimple-pretty-print.cc index 7ec079f15c6..af704257633 100644 --- a/gcc/gimple-pretty-print.cc +++ b/gcc/gimple-pretty-print.cc @@ -339,7 +339,6 @@ dump_unary_rhs (pretty_printer *buffer, const gassign *gs, int spc, switch (rhs_code) { case VIEW_CONVERT_EXPR: -case ASSERT_EXPR: dump_generic_node (buffer, rhs, spc, flags, false); break; diff --git a/gcc/gimple.cc b/gcc/gimple.cc index 6c23dd77609..dd054e16453 100644 --- a/gcc/gimple.cc +++ b/gcc/gimple.cc @@ -2408,7 +2408,6 @@ get_gimple_rhs_num_ops (enum tree_code code) || (SYM) == BIT_INSERT_EXPR) ? GIMPLE_TERNARY_RHS \ : ((SYM) == CONSTRUCTOR