From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1574 invoked by alias); 17 Oct 2009 11:36:12 -0000 Received: (qmail 1565 invoked by uid 22791); 17 Oct 2009 11:36:11 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Oct 2009 11:36:07 +0000 Received: from relay1.suse.de (mail2.suse.de [195.135.221.8]) by mx2.suse.de (Postfix) with ESMTP id 513508655F; Sat, 17 Oct 2009 13:36:05 +0200 (CEST) Date: Sat, 17 Oct 2009 11:39:00 -0000 From: Richard Guenther To: Diego Novillo Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH][LTO] Fixup FIELD_DECLs in COMPONENT_REFs In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323584-1218050490-1255779365=:4520" 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 X-SW-Source: 2009-10/txt/msg01126.txt.bz2 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323584-1218050490-1255779365=:4520 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT Content-length: 2177 On Thu, 15 Oct 2009, Richard Guenther wrote: > On Wed, 14 Oct 2009, Diego Novillo wrote: > > > On Wed, Oct 14, 2009 at 11:55, Richard Guenther wrote: > > > > > 2009-10-14  Richard Guenther   > > > > > >        * tree.c (free_lang_data_in_decl): Free DECL_FCONTEXT. > > >        * lto-streamer-in.c (input_gimple_stmt): Fixup FIELD_DECL > > >        operands in COMPONENT_REFs. > > > > OK. > > Hm. The patch causes two SPEC 2006 benchmarks to miscompare (which > I find odd). I only checked in the tree.c part for now. I have checked in the rest now, it fixes two miscompares now. Re-bootstrapped and tested on x86_64-unknown-linux-gnu. Richard. 2009-10-14 Richard Guenther * lto-streamer-in.c (input_gimple_stmt): Fixup FIELD_DECL operands in COMPONENT_REFs. Index: gcc/lto-streamer-in.c =================================================================== *** gcc/lto-streamer-in.c (revision 152775) --- gcc/lto-streamer-in.c (working copy) *************** input_gimple_stmt (struct lto_input_bloc *** 948,953 **** --- 948,983 ---- { tree op = lto_input_tree (ib, data_in); gimple_set_op (stmt, i, op); + + /* Fixup FIELD_DECLs. */ + while (op && handled_component_p (op)) + { + if (TREE_CODE (op) == COMPONENT_REF) + { + tree field, type, tem; + field = TREE_OPERAND (op, 1); + type = DECL_CONTEXT (field); + for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem)) + { + if (tem == field + || (TREE_TYPE (tem) == TREE_TYPE (field) + && (DECL_FIELD_OFFSET (tem) + == DECL_FIELD_OFFSET (field)) + && (DECL_FIELD_BIT_OFFSET (tem) + == DECL_FIELD_BIT_OFFSET (field)) + && (DECL_OFFSET_ALIGN (tem) + == DECL_OFFSET_ALIGN (field)))) + break; + } + /* In case of type mismatches across units we can fail + to unify some types and thus not find a proper + field-decl here. Just do nothing in this case. */ + if (tem != NULL_TREE) + TREE_OPERAND (op, 1) = tem; + } + + op = TREE_OPERAND (op, 0); + } } break; --8323584-1218050490-1255779365=:4520--