diff options
author | Richard Biener <rguenther@suse.de> | 2015-10-05 11:15:10 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-10-05 11:15:10 +0000 |
commit | 7d475a547690022aeb7e0bfbd51bc476c6ca31c0 (patch) | |
tree | 300323f064d3bc6fbf8d5523ada27413f6902aa3 | |
parent | 9c709f646545f39c49ea0d2efb85b41693e587f4 (diff) | |
download | gcc-7d475a547690022aeb7e0bfbd51bc476c6ca31c0.zip gcc-7d475a547690022aeb7e0bfbd51bc476c6ca31c0.tar.gz gcc-7d475a547690022aeb7e0bfbd51bc476c6ca31c0.tar.bz2 |
re PR ipa/67783 (quadratic time consumption in IPA inlining with -O1 and higher)
2015-10-05 Richard Biener <rguenther@suse.de>
PR ipa/67783
* ipa-inline-analysis.c (estimate_function_body_sizes): Only
consider loop header PHI defs as IVs.
From-SVN: r228472
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ipa-inline-analysis.c | 65 |
2 files changed, 31 insertions, 40 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4b9ed52..c8ab25f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2015-10-05 Richard Biener <rguenther@suse.de> + PR ipa/67783 + * ipa-inline-analysis.c (estimate_function_body_sizes): Only + consider loop header PHI defs as IVs. + +2015-10-05 Richard Biener <rguenther@suse.de> + * tree-ssa-pre.c (create_component_ref_by_pieces_1): Move call handling ... (create_expression_by_pieces): ... here and build GIMPLE diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 108ff3e..786ba43 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -2760,9 +2760,8 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) { vec<edge> exits; edge ex; - unsigned int j, i; + unsigned int j; struct tree_niter_desc niter_desc; - basic_block *body = get_loop_body (loop); bb_predicate = *(struct predicate *) loop->header->aux; exits = get_loop_exit_edges (loop); @@ -2788,46 +2787,32 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early) } exits.release (); - for (i = 0; i < loop->num_nodes; i++) + for (gphi_iterator gsi = gsi_start_phis (loop->header); + !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple_stmt_iterator gsi; - bb_predicate = *(struct predicate *) body[i]->aux; - for (gsi = gsi_start_bb (body[i]); !gsi_end_p (gsi); - gsi_next (&gsi)) - { - gimple *stmt = gsi_stmt (gsi); - affine_iv iv; - ssa_op_iter iter; - tree use; - - FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE) - { - predicate will_be_nonconstant; - - if (!simple_iv - (loop, loop_containing_stmt (stmt), use, &iv, true) - || is_gimple_min_invariant (iv.step)) - continue; - will_be_nonconstant - = will_be_nonconstant_expr_predicate (fbi.info, info, - iv.step, - nonconstant_names); - if (!true_predicate_p (&will_be_nonconstant)) - will_be_nonconstant - = and_predicates (info->conds, - &bb_predicate, - &will_be_nonconstant); - if (!true_predicate_p (&will_be_nonconstant) - && !false_predicate_p (&will_be_nonconstant)) - /* This is slightly inprecise. We may want to represent - each loop with independent predicate. */ - loop_stride = - and_predicates (info->conds, &loop_stride, - &will_be_nonconstant); - } - } + gphi *phi = gsi.phi (); + tree use = gimple_phi_result (phi); + affine_iv iv; + predicate will_be_nonconstant; + if (virtual_operand_p (use) + || !simple_iv (loop, loop, use, &iv, true) + || is_gimple_min_invariant (iv.step)) + continue; + will_be_nonconstant + = will_be_nonconstant_expr_predicate (fbi.info, info, + iv.step, + nonconstant_names); + if (!true_predicate_p (&will_be_nonconstant)) + will_be_nonconstant = and_predicates (info->conds, + &bb_predicate, + &will_be_nonconstant); + if (!true_predicate_p (&will_be_nonconstant) + && !false_predicate_p (&will_be_nonconstant)) + /* This is slightly inprecise. We may want to represent + each loop with independent predicate. */ + loop_stride = and_predicates (info->conds, &loop_stride, + &will_be_nonconstant); } - free (body); } set_hint_predicate (&inline_summaries->get (node)->loop_iterations, loop_iterations); |