Commit 846b1a18 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/79338 (Memory leak in tree-parloops.c)

	PR tree-optimization/79338
	* tree-parloops.c (gather_scalar_reductions): Don't call
	vect_analyze_loop_form for loop->inner before destroying loop's
	loop_vinfo.

From-SVN: r245183
parent a2a86d6a
2017-02-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/79338
* tree-parloops.c (gather_scalar_reductions): Don't call
vect_analyze_loop_form for loop->inner before destroying loop's
loop_vinfo.
2017-02-03 Martin Sebor <msebor@redhat.com>
PR tree-optimization/79327
......
......@@ -2513,8 +2513,8 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list
{
gphi_iterator gsi;
loop_vec_info simple_loop_info;
loop_vec_info simple_inner_loop_info = NULL;
bool allow_double_reduc = true;
auto_vec<gphi *, 4> double_reduc_phis;
auto_vec<gimple *, 4> double_reduc_stmts;
if (!stmt_vec_info_vec.exists ())
init_stmt_vec_info_vec ();
......@@ -2544,19 +2544,31 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list
if (double_reduc)
{
if (!allow_double_reduc
|| loop->inner->inner != NULL)
if (loop->inner->inner != NULL)
continue;
if (!simple_inner_loop_info)
{
simple_inner_loop_info = vect_analyze_loop_form (loop->inner);
if (!simple_inner_loop_info)
{
allow_double_reduc = false;
double_reduc_phis.safe_push (phi);
double_reduc_stmts.safe_push (reduc_stmt);
continue;
}
build_new_reduction (reduction_list, reduc_stmt, phi);
}
destroy_loop_vec_info (simple_loop_info, true);
if (!double_reduc_phis.is_empty ())
{
simple_loop_info = vect_analyze_loop_form (loop->inner);
if (simple_loop_info)
{
gphi *phi;
unsigned int i;
FOR_EACH_VEC_ELT (double_reduc_phis, i, phi)
{
affine_iv iv;
tree res = PHI_RESULT (phi);
bool double_reduc;
use_operand_p use_p;
gimple *inner_stmt;
......@@ -2570,17 +2582,17 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list
continue;
gimple *inner_reduc_stmt
= vect_force_simple_reduction (simple_inner_loop_info, inner_phi,
= vect_force_simple_reduction (simple_loop_info, inner_phi,
true, &double_reduc, true);
gcc_assert (!double_reduc);
if (inner_reduc_stmt == NULL)
continue;
}
build_new_reduction (reduction_list, reduc_stmt, phi);
build_new_reduction (reduction_list, double_reduc_stmts[i], phi);
}
destroy_loop_vec_info (simple_loop_info, true);
destroy_loop_vec_info (simple_inner_loop_info, true);
}
}
gather_done:
/* Release the claim on gimple_uid. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment