tree-inline.c (copy_tree_body_r): Sync MEM_REF code with remap_gimple_op_r.
authorRichard Biener <rguenther@suse.de>
Wed, 20 Mar 2013 13:25:08 +0000 (13:25 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 20 Mar 2013 13:25:08 +0000 (13:25 +0000)
2013-03-20  Richard Biener  <rguenther@suse.de>

* tree-inline.c (copy_tree_body_r): Sync MEM_REF code with
remap_gimple_op_r.

From-SVN: r196824

gcc/ChangeLog
gcc/tree-inline.c

index 9579b6a3fb2e0dcc4e991effd7373a2f29b63498..217a76d9a003e5d8ebe68d7b96e798494eba7d6b 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-20  Richard Biener  <rguenther@suse.de>
+
+       * tree-inline.c (copy_tree_body_r): Sync MEM_REF code with
+       remap_gimple_op_r.
+
 2013-03-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
            Steven Bosscher <steven@gcc.gnu.org>
 
index 5121765fd35bcfaceb5ec0ef621b1b826092189f..b7f76c839f353142bfb115f1e91cfdba84773d64 100644 (file)
@@ -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