From a7dfd82e59e6fd0be6d93ee80489cd6097f762c9 Mon Sep 17 00:00:00 2001 From: amker Date: Tue, 2 May 2017 16:18:42 +0000 Subject: [PATCH] * tree-ssa-loop-ivopts.c (rewrite_use_address): Simple refactor. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247516 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/tree-ssa-loop-ivopts.c | 18 ++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 04323a3cfc1..0bb84d700e0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2017-05-02 Bin Cheng + * tree-ssa-loop-ivopts.c (rewrite_use_address): Simple refactor. + +2017-05-02 Bin Cheng + * tree-ssa-loop-ivopts.c (struct iv_ca): Rename n_regs to n_invs. (ivopts_global_cost_for_size): Rename parameter and update uses. (iv_ca_recount_cost): Update uses. diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 409a35dea73..840bde4d6f0 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -7361,9 +7361,6 @@ rewrite_use_address (struct ivopts_data *data, struct iv_use *use, struct iv_cand *cand) { aff_tree aff; - gimple_stmt_iterator bsi = gsi_for_stmt (use->stmt); - tree base_hint = NULL_TREE; - tree ref, iv; bool ok; adjust_iv_update_pos (cand, use); @@ -7382,17 +7379,18 @@ rewrite_use_address (struct ivopts_data *data, based on an object, the base of the reference is in some subexpression of the use -- but these will use pointer types, so they are recognized by the create_mem_ref heuristics anyway. */ - if (cand->iv->base_object) - base_hint = var_at_stmt (data->current_loop, cand, use->stmt); - - iv = var_at_stmt (data->current_loop, cand, use->stmt); + tree iv = var_at_stmt (data->current_loop, cand, use->stmt); + tree base_hint = (cand->iv->base_object) ? iv : NULL_TREE; + gimple_stmt_iterator bsi = gsi_for_stmt (use->stmt); tree type = TREE_TYPE (*use->op_p); unsigned int align = get_object_alignment (*use->op_p); if (align != TYPE_ALIGN (type)) type = build_aligned_type (type, align); - ref = create_mem_ref (&bsi, type, &aff, - reference_alias_ptr_type (*use->op_p), - iv, base_hint, data->speed); + + tree ref = create_mem_ref (&bsi, type, &aff, + reference_alias_ptr_type (*use->op_p), + iv, base_hint, data->speed); + copy_ref_info (ref, *use->op_p); *use->op_p = ref; } -- 2.11.4.GIT