From f74c4b2c4427a4309d48bfc45bc140422a75aa6f Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 8 Jan 2020 12:49:14 +0000 Subject: [PATCH] re PR tree-optimization/93199 (Compile time hog in sink_clobbers) 2019-01-08 Richard Biener PR middle-end/93199 c/ * gimple-parser.c (c_parser_parse_gimple_body): Remove __PHI IFN permanently. * gimple-fold.c (rewrite_to_defined_overflow): Mark stmt modified. * tree-ssa-loop-im.c (move_computations_worker): Properly adjust virtual operand, also updating SSA use. * gimple-loop-interchange.cc (loop_cand::undo_simple_reduction): Update stmt after resetting virtual operand. (tree_loop_interchange::move_code_to_inner_loop): Likewise. * gimple-iterator.c (gsi_remove): When not removing the stmt permanently do not delink immediate uses or mark the stmt modified. From-SVN: r280000 --- gcc/ChangeLog | 12 ++++++++++++ gcc/c/ChangeLog | 6 ++++++ gcc/c/gimple-parser.c | 2 +- gcc/gimple-fold.c | 1 + gcc/gimple-iterator.c | 8 +++++--- gcc/gimple-loop-interchange.cc | 9 +++++++-- gcc/tree-ssa-loop-im.c | 3 ++- 7 files changed, 34 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7f7402a7d9..3defa292b2d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2019-01-08 Richard Biener + + PR middle-end/93199 + * gimple-fold.c (rewrite_to_defined_overflow): Mark stmt modified. + * tree-ssa-loop-im.c (move_computations_worker): Properly adjust + virtual operand, also updating SSA use. + * gimple-loop-interchange.cc (loop_cand::undo_simple_reduction): + Update stmt after resetting virtual operand. + (tree_loop_interchange::move_code_to_inner_loop): Likewise. + * gimple-iterator.c (gsi_remove): When not removing the stmt + permanently do not delink immediate uses or mark the stmt modified. + 2020-01-08 Martin Liska * ipa-fnsummary.c (dump_ipa_call_summary): Use symtab_node::dump_name. diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index a4b198063d1..d0b65594376 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2019-01-08 Richard Biener + + PR middle-end/93199 + * gimple-parser.c (c_parser_parse_gimple_body): Remove __PHI IFN + permanently. + 2020-01-01 Jakub Jelinek Update copyright years. diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c index 7e4cd3901e5..3370178be18 100644 --- a/gcc/c/gimple-parser.c +++ b/gcc/c/gimple-parser.c @@ -327,7 +327,7 @@ c_parser_parse_gimple_body (c_parser *cparser, char *gimple_pass, add_phi_arg (phi, gimple_call_arg (stmt, i + 1), e, UNKNOWN_LOCATION); } - gsi_remove (&gsi, false); + gsi_remove (&gsi, true); } /* Fill SSA name gaps, putting them on the freelist. */ for (unsigned i = 1; i < num_ssa_names; ++i) diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 8c9457269a7..d7c5097db40 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -7380,6 +7380,7 @@ rewrite_to_defined_overflow (gimple *stmt) gimple_assign_set_lhs (stmt, make_ssa_name (type, stmt)); if (gimple_assign_rhs_code (stmt) == POINTER_PLUS_EXPR) gimple_assign_set_rhs_code (stmt, PLUS_EXPR); + gimple_set_modified (stmt, true); gimple_seq_add_stmt (&stmts, stmt); gimple *cvt = gimple_build_assign (lhs, NOP_EXPR, gimple_assign_lhs (stmt)); gimple_seq_add_stmt (&stmts, cvt); diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c index 0ccca23a233..d401c69f36b 100644 --- a/gcc/gimple-iterator.c +++ b/gcc/gimple-iterator.c @@ -558,16 +558,18 @@ gsi_remove (gimple_stmt_iterator *i, bool remove_permanently) gimple *stmt = gsi_stmt (*i); bool require_eh_edge_purge = false; + /* ??? Do we want to do this for non-permanent operation? */ if (gimple_code (stmt) != GIMPLE_PHI) insert_debug_temps_for_defs (i); - /* Free all the data flow information for STMT. */ gimple_set_bb (stmt, NULL); - delink_stmt_imm_use (stmt); - gimple_set_modified (stmt, true); if (remove_permanently) { + /* Free all the data flow information for STMT. */ + delink_stmt_imm_use (stmt); + gimple_set_modified (stmt, true); + if (gimple_debug_nonbind_marker_p (stmt)) /* We don't need this to be exact, but try to keep it at least close. */ diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc index b3cb7700d89..2379848808f 100644 --- a/gcc/gimple-loop-interchange.cc +++ b/gcc/gimple-loop-interchange.cc @@ -879,6 +879,7 @@ loop_cand::undo_simple_reduction (reduction_p re, bitmap dce_seeds) if (re->producer != NULL) { gimple_set_vuse (re->producer, NULL_TREE); + update_stmt (re->producer); from = gsi_for_stmt (re->producer); gsi_remove (&from, false); gimple_seq_add_stmt_without_update (&stmts, re->producer); @@ -920,6 +921,7 @@ loop_cand::undo_simple_reduction (reduction_p re, bitmap dce_seeds) gimple_set_vdef (re->consumer, NULL_TREE); gimple_set_vuse (re->consumer, NULL_TREE); gimple_assign_set_rhs1 (re->consumer, re->next); + update_stmt (re->consumer); from = gsi_for_stmt (re->consumer); to = gsi_for_stmt (SSA_NAME_DEF_STMT (re->next)); gsi_move_after (&from, &to); @@ -1248,14 +1250,17 @@ tree_loop_interchange::move_code_to_inner_loop (class loop *outer, continue; } - if (gimple_vuse (stmt)) - gimple_set_vuse (stmt, NULL_TREE); if (gimple_vdef (stmt)) { unlink_stmt_vdef (stmt); release_ssa_name (gimple_vdef (stmt)); gimple_set_vdef (stmt, NULL_TREE); } + if (gimple_vuse (stmt)) + { + gimple_set_vuse (stmt, NULL_TREE); + update_stmt (stmt); + } reset_debug_uses (stmt); gsi_move_before (&gsi, &to); diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index dd9df25f5d7..3e64ae71944 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -1231,7 +1231,8 @@ move_computations_worker (basic_block bb) gphi *phi = gsi2.phi (); if (virtual_operand_p (gimple_phi_result (phi))) { - gimple_set_vuse (stmt, PHI_ARG_DEF_FROM_EDGE (phi, e)); + SET_USE (gimple_vuse_op (stmt), + PHI_ARG_DEF_FROM_EDGE (phi, e)); break; } } -- 2.30.2