From b94b4cf4ebfa46f33114153d3380d93f42e69e01 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 20 Mar 2013 13:25:08 +0000 Subject: 2013-03-20 Richard Biener * tree-inline.c (copy_tree_body_r): Sync MEM_REF code with remap_gimple_op_r. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196824 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-inline.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'gcc/tree-inline.c') diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 5121765fd35..b7f76c839f3 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1092,22 +1092,22 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data) } else if (TREE_CODE (*tp) == MEM_REF) { - /* We need to re-canonicalize MEM_REFs from inline substitutions - that can happen when a pointer argument is an ADDR_EXPR. */ - tree decl = TREE_OPERAND (*tp, 0); - tree *n; + tree ptr = TREE_OPERAND (*tp, 0); + tree type = remap_type (TREE_TYPE (*tp), id); + tree old = *tp; - n = (tree *) pointer_map_contains (id->decl_map, decl); - if (n) - { - tree old = *tp; - *tp = fold_build2 (MEM_REF, TREE_TYPE (*tp), - unshare_expr (*n), TREE_OPERAND (*tp, 1)); - TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old); - TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old); - *walk_subtrees = 0; - return NULL; - } + /* We need to re-canonicalize MEM_REFs from inline substitutions + that can happen when a pointer argument is an ADDR_EXPR. + Recurse here manually to allow that. */ + walk_tree (&ptr, copy_tree_body_r, data, NULL); + *tp = fold_build2 (MEM_REF, type, + ptr, TREE_OPERAND (*tp, 1)); + TREE_THIS_NOTRAP (*tp) = TREE_THIS_NOTRAP (old); + TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old); + TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old); + TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old); + *walk_subtrees = 0; + return NULL; } /* Here is the "usual case". Copy this tree node, and then -- cgit v1.2.1 From 8e966116ccd5aef7a3965e4375e9ed2384357303 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 21 Mar 2013 11:53:39 +0000 Subject: 2013-03-21 Richard Biener * tree.h (DECL_DEBUG_EXPR_IS_FROM): Rename to ... (DECL_HAS_DEBUG_EXPR_P): ... this. Guard properly. * tree.c (copy_node_stat): Do not copy DECL_HAS_DEBUG_EXPR_P. * dwarf2out.c (add_var_loc_to_decl): Use DECL_HAS_DEBUG_EXPR_P instead of DECL_DEBUG_EXPR_IS_FROM. * gimplify.c (gimplify_modify_expr): Likewise. * tree-cfg.c (verify_expr_location_1): Likewise. * tree-complex.c (create_one_component_var): Likewise. * tree-sra.c (create_access_replacement): Likewise. * tree-ssa-live.c (clear_unused_block_pointer_1): Likewise. (clear_unused_block_pointer): Likewise. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Likewise. * tree-streamer-out.c (pack_ts_decl_common_value_fields): Likewise. * var-tracking.c (var_debug_decl): Likewise. (track_expr_p): Likewise. * tree-inline.c (add_local_variables): Likewise. Set DECL_HAS_DEBUG_EXPR_P after copying it. * tree-diagnostic.c (default_tree_printer): Use DECL_HAS_DEBUG_EXPR_P instead of DECL_DEBUG_EXPR_IS_FROM. Guard properly. c/ * c-objc-common.c (c_tree_printer): Use DECL_HAS_DEBUG_EXPR_P instead of DECL_DEBUG_EXPR_IS_FROM. Guard properly. cp/ * error.c (cp_printer): Use DECL_HAS_DEBUG_EXPR_P instead of DECL_DEBUG_EXPR_IS_FROM. Guard properly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196864 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-inline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree-inline.c') diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index b7f76c839f3..a41dd5aeb82 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3762,7 +3762,7 @@ add_local_variables (struct function *callee, struct function *caller, /* Remap debug-expressions. */ if (TREE_CODE (new_var) == VAR_DECL - && DECL_DEBUG_EXPR_IS_FROM (new_var) + && DECL_HAS_DEBUG_EXPR_P (var) && new_var != var) { tree tem = DECL_DEBUG_EXPR (var); @@ -3772,6 +3772,7 @@ add_local_variables (struct function *callee, struct function *caller, id->remapping_type_depth--; id->regimplify = old_regimplify; SET_DECL_DEBUG_EXPR (new_var, tem); + DECL_HAS_DEBUG_EXPR_P (new_var) = 1; } add_local_decl (caller, new_var); } -- cgit v1.2.1