From patchwork Wed Mar 20 13:23:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 229381 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 94A592C00AB for ; Thu, 21 Mar 2013 00:23:28 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=pAg5HCndU6IF/5KohI+lBUUDmlBritM51UNYamQ5dEWo6KMJUY3DR /JNElz2fJTQLGfMKyutKF2+ftLbwHevWbS5ygem7BwFKG/zIlcExhLeeVZF0zDH/ t+bmiqyx5sPiKmrQPc7x8w2zSWvKiFymvxwB5p5scSVTzEtIVKQin0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=sPI8Kicf7fFVYrCV9x3xet2Oen4=; b=tgt9obh0Xwy7NDXC+rmP 3uZtoEQ0N8DCF/vN8CmuMdDxznEFsjo+dAbj8xpiCLFY1bS5Uvu5fY75NdMdN/uZ KrnGNgK45uB+j/ErhqCUInS8yX50PCJG9RHPGHAkhNLT1QrQ02WNEcvV/PZkidX1 lhRZj5iOnFWJqExDrG3nGJw= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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 14:23:11 +0100 (CET) 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 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