From: Richard Biener Date: Mon, 21 Aug 2017 07:21:33 +0000 (+0000) Subject: tree-ssa-loop-im.c (struct lim_aux_data): Add ref index member. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5164293abdea95879f97d4ad711aee010cdbbc95;p=gcc.git tree-ssa-loop-im.c (struct lim_aux_data): Add ref index member. 2017-08-21 Richard Biener * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b25afd54286..f4f12e072c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2017-08-21 Richard Biener + + * 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 * config/i386/i386.h (OPTION_MASK_ISA_ROUND): Remove. diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 2fbaa62c142..503e662452c 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -86,7 +86,9 @@ struct lim_aux_data unsigned cost; /* Cost of the computation performed by the statement. */ - vec depends; /* Vector of statements that must be also + unsigned ref; /* The simple_mem_ref in this stmt or 0. */ + + vec 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 @@ -586,27 +588,6 @@ simple_mem_ref_in_stmt (gimple *stmt, bool *is_store) 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 @@ -747,23 +728,18 @@ determine_max_movement (gimple *stmt, bool must_preserve_exec) 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); @@ -1000,7 +976,9 @@ invariantness_dom_walker::before_dom_children (basic_block bb) 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)) @@ -1037,7 +1015,9 @@ invariantness_dom_walker::before_dom_children (basic_block bb) 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; @@ -1073,7 +1053,9 @@ invariantness_dom_walker::before_dom_children (basic_block bb) 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) @@ -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); mark_ref_stored (ref, loop); } + init_lim_data (stmt)->ref = ref->id; return; }