From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11231 invoked by alias); 20 Mar 2013 13:23:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 11192 invoked by uid 89); 20 Mar 2013 13:23:15 -0000 X-Spam-SWARE-Status: No, score=-7.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD autolearn=ham version=3.3.1 Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 20 Mar 2013 13:23:13 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 34050A4F28 for ; Wed, 20 Mar 2013 14:23:11 +0100 (CET) Date: Wed, 20 Mar 2013 13:23:00 -0000 From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Sync copy_tree_body_r with remap_gimple_op_r Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2013-03/txt/msg00739.txt.bz2 Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Next I'll merge the two functions. Richard. 2013-03-20 Richard Biener * 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