Commit fdce493d by Tom de Vries Committed by Tom de Vries

Fix parloops gimple_uid usage

2015-10-13  Tom de Vries  <tom@codesourcery.com>

	* tree-parloops.c (reduction_phi): Handle cases that gimple_uid is 0 or
	-1.  Add assert that returned entry matches phi argument.
	(parallelize_loops): Move calls to init_stmt_vec_info_vec and
	free_stmt_vec_info_vec ...
	(gather_scalar_reductions): ... here.  Initialize gimple_uids of phis
	with -1.

From-SVN: r228767
parent f35a4f37
2015-10-13 Tom de Vries <tom@codesourcery.com>
* tree-parloops.c (reduction_phi): Handle cases that gimple_uid is 0 or
-1. Add assert that returned entry matches phi argument.
(parallelize_loops): Move calls to init_stmt_vec_info_vec and
free_stmt_vec_info_vec ...
(gather_scalar_reductions): ... here. Initialize gimple_uids of phis
with -1.
2014-10-13 Yuri Rumyantsev <ysrumyan@gmail.com> 2014-10-13 Yuri Rumyantsev <ysrumyan@gmail.com>
PR tree-optimization/67909, 67947 PR tree-optimization/67909, 67947
...@@ -238,9 +238,14 @@ reduction_phi (reduction_info_table_type *reduction_list, gimple *phi) ...@@ -238,9 +238,14 @@ reduction_phi (reduction_info_table_type *reduction_list, gimple *phi)
if (reduction_list->elements () == 0 || phi == NULL) if (reduction_list->elements () == 0 || phi == NULL)
return NULL; return NULL;
if (gimple_uid (phi) == (unsigned int)-1
|| gimple_uid (phi) == 0)
return NULL;
tmpred.reduc_phi = phi; tmpred.reduc_phi = phi;
tmpred.reduc_version = gimple_uid (phi); tmpred.reduc_version = gimple_uid (phi);
red = reduction_list->find (&tmpred); red = reduction_list->find (&tmpred);
gcc_assert (red == NULL || red->reduc_phi == phi);
return red; return red;
} }
...@@ -2416,6 +2421,9 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list ...@@ -2416,6 +2421,9 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list
loop_vec_info simple_inner_loop_info = NULL; loop_vec_info simple_inner_loop_info = NULL;
bool allow_double_reduc = true; bool allow_double_reduc = true;
if (!stmt_vec_info_vec.exists ())
init_stmt_vec_info_vec ();
simple_loop_info = vect_analyze_loop_form (loop); simple_loop_info = vect_analyze_loop_form (loop);
if (simple_loop_info == NULL) if (simple_loop_info == NULL)
return; return;
...@@ -2477,9 +2485,16 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list ...@@ -2477,9 +2485,16 @@ gather_scalar_reductions (loop_p loop, reduction_info_table_type *reduction_list
destroy_loop_vec_info (simple_loop_info, true); destroy_loop_vec_info (simple_loop_info, true);
destroy_loop_vec_info (simple_inner_loop_info, true); destroy_loop_vec_info (simple_inner_loop_info, true);
/* Release the claim on gimple_uid. */
free_stmt_vec_info_vec ();
/* As gimple_uid is used by the vectorizer in between vect_analyze_loop_form /* As gimple_uid is used by the vectorizer in between vect_analyze_loop_form
and destroy_loop_vec_info, we can set gimple_uid of reduc_phi stmts and free_stmt_vec_info_vec, we can set gimple_uid of reduc_phi stmts only
only now. */ now. */
basic_block bb;
FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
gimple_set_uid (gsi_stmt (gsi), (unsigned int)-1);
reduction_list->traverse <void *, set_reduc_phi_uids> (NULL); reduction_list->traverse <void *, set_reduc_phi_uids> (NULL);
} }
...@@ -2627,7 +2642,6 @@ parallelize_loops (void) ...@@ -2627,7 +2642,6 @@ parallelize_loops (void)
gcc_obstack_init (&parloop_obstack); gcc_obstack_init (&parloop_obstack);
reduction_info_table_type reduction_list (10); reduction_info_table_type reduction_list (10);
init_stmt_vec_info_vec ();
FOR_EACH_LOOP (loop, 0) FOR_EACH_LOOP (loop, 0)
{ {
...@@ -2719,7 +2733,6 @@ parallelize_loops (void) ...@@ -2719,7 +2733,6 @@ parallelize_loops (void)
n_threads, &niter_desc); n_threads, &niter_desc);
} }
free_stmt_vec_info_vec ();
obstack_free (&parloop_obstack, NULL); obstack_free (&parloop_obstack, NULL);
/* Parallelization will cause new function calls to be inserted through /* Parallelization will cause new function calls to be inserted through
......
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