diff options
author | bviyer <bviyer@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-02 03:05:34 +0000 |
---|---|---|
committer | bviyer <bviyer@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-02 03:05:34 +0000 |
commit | ac89096030dcb12e19837fccbfb2f837d5a2a477 (patch) | |
tree | fd3311ee4356cd2c69fa72fa3432c5388a6fbaba /gcc/tree-inline.c | |
parent | 796834d7c903d589fd513a5df6c4f70c37519680 (diff) | |
parent | aea49cc901e30bbe7ff2e416c413c5aacc3ad02d (diff) | |
download | gcc-ac89096030dcb12e19837fccbfb2f837d5a2a477.tar.gz |
Merged with trunk at revision 191917.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/cilkplus@191953 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 69 |
1 files changed, 38 insertions, 31 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index aff83c0965f..4bac2b8fee8 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -830,16 +830,6 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data) /* Otherwise, just copy the node. Note that copy_tree_r already knows not to copy VAR_DECLs, etc., so this is safe. */ - /* We should never have TREE_BLOCK set on non-statements. */ - if (EXPR_P (*tp)) - { - /* Some part of Cilk Code maybe setting this but not using. So if - * we do see this, then we clear it out */ - if (flag_enable_cilk && TREE_BLOCK (*tp)) - TREE_BLOCK (*tp) = NULL_TREE; - else - gcc_assert (!TREE_BLOCK (*tp)); - } if (TREE_CODE (*tp) == MEM_REF) { tree ptr = TREE_OPERAND (*tp, 0); @@ -878,13 +868,9 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data) { /* Variable substitution need not be simple. In particular, the MEM_REF substitution above. Make sure that - TREE_CONSTANT and friends are up-to-date. But make sure - to not improperly set TREE_BLOCK on some sub-expressions. */ + TREE_CONSTANT and friends are up-to-date. */ int invariant = is_gimple_min_invariant (*tp); - tree block = id->block; - id->block = NULL_TREE; walk_tree (&TREE_OPERAND (*tp, 0), remap_gimple_op_r, data, NULL); - id->block = block; recompute_tree_invariant_for_addr_expr (*tp); /* If this used to be invariant, but is not any longer, @@ -896,6 +882,22 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data) } } + /* Update the TREE_BLOCK for the cloned expr. */ + if (EXPR_P (*tp)) + { + tree new_block = id->remapping_type_depth == 0 ? id->block : NULL; + tree old_block = TREE_BLOCK (*tp); + if (old_block) + { + tree *n; + n = (tree *) pointer_map_contains (id->decl_map, + TREE_BLOCK (*tp)); + if (n) + new_block = *n; + } + TREE_SET_BLOCK (*tp, new_block); + } + /* Keep iterating. */ return NULL_TREE; } @@ -1135,11 +1137,10 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data) tree *n; n = (tree *) pointer_map_contains (id->decl_map, TREE_BLOCK (*tp)); - gcc_assert (n || id->remapping_type_depth != 0); if (n) new_block = *n; } - TREE_BLOCK (*tp) = new_block; + TREE_SET_BLOCK (*tp, new_block); } if (TREE_CODE (*tp) != OMP_CLAUSE) @@ -2010,6 +2011,7 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id) tree new_arg; tree block = id->block; edge_iterator ei2; + location_t locus; /* When doing partial cloning, we allow PHIs on the entry block as long as all the arguments are the same. Find any input @@ -2021,9 +2023,7 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id) arg = PHI_ARG_DEF_FROM_EDGE (phi, old_edge); new_arg = arg; - id->block = NULL_TREE; walk_tree (&new_arg, copy_tree_body_r, id, NULL); - id->block = block; gcc_assert (new_arg); /* With return slot optimization we can end up with non-gimple (foo *)&this->m, fix that here. */ @@ -2036,8 +2036,20 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id) gsi_insert_seq_on_edge (new_edge, stmts); inserted = true; } - add_phi_arg (new_phi, new_arg, new_edge, - gimple_phi_arg_location_from_edge (phi, old_edge)); + locus = gimple_phi_arg_location_from_edge (phi, old_edge); + block = id->block; + if (LOCATION_BLOCK (locus)) + { + tree *n; + n = (tree *) pointer_map_contains (id->decl_map, + LOCATION_BLOCK (locus)); + gcc_assert (n); + block = *n; + } + + add_phi_arg (new_phi, new_arg, new_edge, block ? + COMBINE_LOCATION_DATA (line_table, locus, block) : + LOCATION_LOCUS (locus)); } } } @@ -2058,7 +2070,8 @@ remap_decl_1 (tree decl, void *data) } /* Build struct function and associated datastructures for the new clone - NEW_FNDECL to be build. CALLEE_FNDECL is the original */ + NEW_FNDECL to be build. CALLEE_FNDECL is the original. Function changes + the cfun to the function of new_fndecl (and current_function_decl too). */ static void initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count) @@ -2123,7 +2136,6 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count) cfun->gimple_df->in_ssa_p = true; init_ssa_operands (cfun); } - pop_cfun (); } /* Helper function for copy_cfg_body. Move debug stmts from the end @@ -3902,7 +3914,8 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) id->block = make_node (BLOCK); BLOCK_ABSTRACT_ORIGIN (id->block) = fn; BLOCK_SOURCE_LOCATION (id->block) = input_location; - prepend_lexical_block (gimple_block (stmt), id->block); + if (gimple_block (stmt)) + prepend_lexical_block (gimple_block (stmt), id->block); /* Local declarations will be replaced by their equivalents in this map. */ @@ -5123,8 +5136,6 @@ tree_function_versioning (tree old_decl, tree new_decl, struct ipa_replace_map *replace_info; basic_block old_entry_block, bb; VEC (gimple, heap) *init_stmts = VEC_alloc (gimple, heap, 10); - - tree old_current_function_decl = current_function_decl; tree vars = NULL_TREE; gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL @@ -5195,14 +5206,12 @@ tree_function_versioning (tree old_decl, tree new_decl, id.transform_return_to_modify = false; id.transform_lang_insert_block = NULL; - current_function_decl = new_decl; old_entry_block = ENTRY_BLOCK_PTR_FOR_FUNCTION (DECL_STRUCT_FUNCTION (old_decl)); initialize_cfun (new_decl, old_decl, old_entry_block->count); DECL_STRUCT_FUNCTION (new_decl)->gimple_df->ipa_pta = id.src_cfun->gimple_df->ipa_pta; - push_cfun (DECL_STRUCT_FUNCTION (new_decl)); /* Copy the function's static chain. */ p = DECL_STRUCT_FUNCTION (old_decl)->static_chain_decl; @@ -5356,9 +5365,6 @@ tree_function_versioning (tree old_decl, tree new_decl, gcc_assert (!id.debug_stmts); VEC_free (gimple, heap, init_stmts); pop_cfun (); - current_function_decl = old_current_function_decl; - gcc_assert (!current_function_decl - || DECL_STRUCT_FUNCTION (current_function_decl) == cfun); return; } @@ -5367,6 +5373,7 @@ initialize_elem_fn_cfun (tree new_fndecl, tree callee_fndecl) { struct function *src_cfun = DECL_STRUCT_FUNCTION (callee_fndecl); + gimple_register_cfg_hooks (); /* Get clean struct function. */ push_struct_function (new_fndecl); |