+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>
* config/i386/i386.h (OPTION_MASK_ISA_ROUND): Remove.
unsigned cost; /* Cost of the computation performed by the
statement. */
- vec<gimple *> depends; /* Vector of statements that must be also
+ unsigned ref; /* The simple_mem_ref in this stmt or 0. */
+
+ vec<gimple *> depends; /* Vector of statements that must be also
hoisted out of the loop when this statement
is hoisted; i.e. those that define the
operands of the statement and are inside of
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
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
if (gimple_vuse (stmt))
{
- im_mem_ref *ref = mem_ref_in_stmt (stmt);
-
- if (ref)
+ im_mem_ref *ref
+ = lim_data ? memory_accesses.refs_list[lim_data->ref] : NULL;
+ if (ref
+ && MEM_ANALYZABLE (ref))
{
- lim_data->max_loop
- = outermost_indep_loop (lim_data->max_loop, loop, ref);
+ lim_data->max_loop = outermost_indep_loop (lim_data->max_loop,
+ loop, ref);
if (!lim_data->max_loop)
return false;
}
- else
- {
- if ((val = gimple_vuse (stmt)) != NULL_TREE)
- {
- if (!add_dependency (val, lim_data, loop, false))
- return false;
- }
- }
+ else if (! add_dependency (gimple_vuse (stmt), lim_data, loop, false))
+ return false;
}
lim_data->cost += stmt_cost (stmt);
if (pos == MOVE_IMPOSSIBLE)
continue;
- lim_data = init_lim_data (stmt);
+ lim_data = get_lim_data (stmt);
+ if (! lim_data)
+ lim_data = init_lim_data (stmt);
lim_data->always_executed_in = outermost;
if (!determine_max_movement (stmt, false))
store-motion work. */
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;
}
continue;
stmt = rewrite_bittest (&bsi);
}
- lim_data = init_lim_data (stmt);
+ lim_data = get_lim_data (stmt);
+ if (! lim_data)
+ lim_data = init_lim_data (stmt);
lim_data->always_executed_in = outermost;
if (maybe_never && pos == MOVE_PRESERVE_EXECUTION)
bitmap_set_bit (&memory_accesses.refs_stored_in_loop[loop->num], ref->id);
mark_ref_stored (ref, loop);
}
+ init_lim_data (stmt)->ref = ref->id;
return;
}