* [PATCH] Sync copy_tree_body_r with remap_gimple_op_r
@ 2013-03-20 13:23 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2013-03-20 13:23 UTC (permalink / raw)
To: gcc-patches
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Next I'll merge the two functions.
Richard.
2013-03-20 Richard Biener <rguenther@suse.de>
* tree-inline.c (copy_tree_body_r): Sync MEM_REF code with
remap_gimple_op_r.
Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c (revision 196808)
+++ gcc/tree-inline.c (working copy)
@@ -1092,22 +1092,22 @@ copy_tree_body_r (tree *tp, int *walk_su
}
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-03-20 13:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-20 13:23 [PATCH] Sync copy_tree_body_r with remap_gimple_op_r Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).