diff options
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 9a5edd19039..baaf0b0eece 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2307,7 +2307,7 @@ remove_bb (basic_block bb) new_bb = single_succ (new_bb); gcc_assert (new_bb != bb); } - new_gsi = gsi_start_bb (new_bb); + new_gsi = gsi_after_labels (new_bb); gsi_remove (&i, false); gsi_insert_before (&new_gsi, stmt, GSI_NEW_STMT); } @@ -6308,7 +6308,7 @@ gimple_can_duplicate_bb_p (const_basic_block bb ATTRIBUTE_UNUSED) preserve SSA form. */ static basic_block -gimple_duplicate_bb (basic_block bb) +gimple_duplicate_bb (basic_block bb, copy_bb_data *id) { basic_block new_bb; gimple_stmt_iterator gsi_tgt; @@ -6372,6 +6372,39 @@ gimple_duplicate_bb (basic_block bb) && (!VAR_P (base) || !DECL_HAS_VALUE_EXPR_P (base))) DECL_NONSHAREABLE (base) = 1; } + + /* If requested remap dependence info of cliques brought in + via inlining. */ + if (id) + for (unsigned i = 0; i < gimple_num_ops (copy); ++i) + { + tree op = gimple_op (copy, i); + if (!op) + continue; + if (TREE_CODE (op) == ADDR_EXPR + || TREE_CODE (op) == WITH_SIZE_EXPR) + op = TREE_OPERAND (op, 0); + while (handled_component_p (op)) + op = TREE_OPERAND (op, 0); + if ((TREE_CODE (op) == MEM_REF + || TREE_CODE (op) == TARGET_MEM_REF) + && MR_DEPENDENCE_CLIQUE (op) > 1 + && MR_DEPENDENCE_CLIQUE (op) != bb->loop_father->owned_clique) + { + if (!id->dependence_map) + id->dependence_map = new hash_map<dependence_hash, + unsigned short>; + bool existed; + unsigned short &newc = id->dependence_map->get_or_insert + (MR_DEPENDENCE_CLIQUE (op), &existed); + if (!existed) + { + gcc_assert (MR_DEPENDENCE_CLIQUE (op) <= cfun->last_clique); + newc = ++cfun->last_clique; + } + MR_DEPENDENCE_CLIQUE (op) = newc; + } + } /* Create new names for all the definitions created by COPY and add replacement mappings for each new name. */ @@ -7199,7 +7232,14 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb, if (virtual_operand_p (op)) { /* Remove the phi nodes for virtual operands (alias analysis will be - run for the new function, anyway). */ + run for the new function, anyway). But replace all uses that + might be outside of the region we move. */ + use_operand_p use_p; + imm_use_iterator iter; + gimple *use_stmt; + FOR_EACH_IMM_USE_STMT (use_stmt, iter, op) + FOR_EACH_IMM_USE_ON_STMT (use_p, iter) + SET_USE (use_p, SSA_NAME_VAR (op)); remove_phi_node (&psi, true); continue; } |