Commit 5164293a by Richard Biener Committed by Richard Biener

tree-ssa-loop-im.c (struct lim_aux_data): Add ref index member.

2017-08-21  Richard Biener  <rguenther@suse.de>

	* tree-ssa-loop-im.c (struct lim_aux_data): Add ref index member.
	(mem_ref_in_stmt): Remove.
	(determine_max_movement): Use ref index to get at the reference.
	(invariantness_dom_walker::before_dom_children): Deal with
	lim data already initialized.
	(gather_mem_refs_stmt): Initialize lim data and record ref index.

From-SVN: r251216
parent 8bd81a41
2017-08-21 Richard Biener <rguenther@suse.de>
* tree-ssa-loop-im.c (struct lim_aux_data): Add ref index member.
(mem_ref_in_stmt): Remove.
(determine_max_movement): Use ref index to get at the reference.
(invariantness_dom_walker::before_dom_children): Deal with
lim data already initialized.
(gather_mem_refs_stmt): Initialize lim data and record ref index.
2017-08-19 Uros Bizjak <ubizjak@gmail.com> 2017-08-19 Uros Bizjak <ubizjak@gmail.com>
* config/i386/i386.h (OPTION_MASK_ISA_ROUND): Remove. * config/i386/i386.h (OPTION_MASK_ISA_ROUND): Remove.
......
...@@ -86,6 +86,8 @@ struct lim_aux_data ...@@ -86,6 +86,8 @@ struct lim_aux_data
unsigned cost; /* Cost of the computation performed by the unsigned cost; /* Cost of the computation performed by the
statement. */ statement. */
unsigned ref; /* The simple_mem_ref in this stmt or 0. */
vec<gimple *> depends; /* Vector of statements that must be also vec<gimple *> depends; /* Vector of statements that must be also
hoisted out of the loop when this statement hoisted out of the loop when this statement
is hoisted; i.e. those that define the is hoisted; i.e. those that define the
...@@ -586,27 +588,6 @@ simple_mem_ref_in_stmt (gimple *stmt, bool *is_store) ...@@ -586,27 +588,6 @@ simple_mem_ref_in_stmt (gimple *stmt, bool *is_store)
return NULL; return NULL;
} }
/* Returns the memory reference contained in STMT. */
static im_mem_ref *
mem_ref_in_stmt (gimple *stmt)
{
bool store;
tree *mem = simple_mem_ref_in_stmt (stmt, &store);
hashval_t hash;
im_mem_ref *ref;
if (!mem)
return NULL;
gcc_assert (!store);
hash = iterative_hash_expr (*mem, 0);
ref = memory_accesses.refs->find_with_hash (*mem, hash);
gcc_assert (ref != NULL);
return ref;
}
/* From a controlling predicate in DOM determine the arguments from /* From a controlling predicate in DOM determine the arguments from
the PHI node PHI that are chosen if the predicate evaluates to the PHI node PHI that are chosen if the predicate evaluates to
true and false and store them to *TRUE_ARG_P and *FALSE_ARG_P if true and false and store them to *TRUE_ARG_P and *FALSE_ARG_P if
...@@ -747,24 +728,19 @@ determine_max_movement (gimple *stmt, bool must_preserve_exec) ...@@ -747,24 +728,19 @@ determine_max_movement (gimple *stmt, bool must_preserve_exec)
if (gimple_vuse (stmt)) if (gimple_vuse (stmt))
{ {
im_mem_ref *ref = mem_ref_in_stmt (stmt); im_mem_ref *ref
= lim_data ? memory_accesses.refs_list[lim_data->ref] : NULL;
if (ref) if (ref
&& MEM_ANALYZABLE (ref))
{ {
lim_data->max_loop lim_data->max_loop = outermost_indep_loop (lim_data->max_loop,
= outermost_indep_loop (lim_data->max_loop, loop, ref); loop, ref);
if (!lim_data->max_loop) if (!lim_data->max_loop)
return false; return false;
} }
else else if (! add_dependency (gimple_vuse (stmt), lim_data, loop, false))
{
if ((val = gimple_vuse (stmt)) != NULL_TREE)
{
if (!add_dependency (val, lim_data, loop, false))
return false; return false;
} }
}
}
lim_data->cost += stmt_cost (stmt); lim_data->cost += stmt_cost (stmt);
...@@ -1000,6 +976,8 @@ invariantness_dom_walker::before_dom_children (basic_block bb) ...@@ -1000,6 +976,8 @@ invariantness_dom_walker::before_dom_children (basic_block bb)
if (pos == MOVE_IMPOSSIBLE) if (pos == MOVE_IMPOSSIBLE)
continue; continue;
lim_data = get_lim_data (stmt);
if (! lim_data)
lim_data = init_lim_data (stmt); lim_data = init_lim_data (stmt);
lim_data->always_executed_in = outermost; lim_data->always_executed_in = outermost;
...@@ -1037,7 +1015,9 @@ invariantness_dom_walker::before_dom_children (basic_block bb) ...@@ -1037,7 +1015,9 @@ invariantness_dom_walker::before_dom_children (basic_block bb)
store-motion work. */ store-motion work. */
else if (stmt_makes_single_store (stmt)) else if (stmt_makes_single_store (stmt))
{ {
struct lim_aux_data *lim_data = init_lim_data (stmt); struct lim_aux_data *lim_data = get_lim_data (stmt);
if (! lim_data)
lim_data = init_lim_data (stmt);
lim_data->always_executed_in = outermost; lim_data->always_executed_in = outermost;
} }
continue; continue;
...@@ -1073,6 +1053,8 @@ invariantness_dom_walker::before_dom_children (basic_block bb) ...@@ -1073,6 +1053,8 @@ invariantness_dom_walker::before_dom_children (basic_block bb)
stmt = rewrite_bittest (&bsi); stmt = rewrite_bittest (&bsi);
} }
lim_data = get_lim_data (stmt);
if (! lim_data)
lim_data = init_lim_data (stmt); lim_data = init_lim_data (stmt);
lim_data->always_executed_in = outermost; lim_data->always_executed_in = outermost;
...@@ -1498,6 +1480,7 @@ gather_mem_refs_stmt (struct loop *loop, gimple *stmt) ...@@ -1498,6 +1480,7 @@ gather_mem_refs_stmt (struct loop *loop, gimple *stmt)
bitmap_set_bit (&memory_accesses.refs_stored_in_loop[loop->num], ref->id); bitmap_set_bit (&memory_accesses.refs_stored_in_loop[loop->num], ref->id);
mark_ref_stored (ref, loop); mark_ref_stored (ref, loop);
} }
init_lim_data (stmt)->ref = ref->id;
return; return;
} }
......
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