From patchwork Mon May 30 14:53:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 97920 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]) by ozlabs.org (Postfix) with SMTP id 840ACB6F67 for ; Tue, 31 May 2011 00:54:08 +1000 (EST) Received: (qmail 10400 invoked by alias); 30 May 2011 14:54:04 -0000 Received: (qmail 10382 invoked by uid 22791); 30 May 2011 14:54:02 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 30 May 2011 14:53:48 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 736585362F for ; Mon, 30 May 2011 16:53:47 +0200 (CEST) Date: Mon, 30 May 2011 16:53:47 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Another LTO type merging cleanup Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 This structures field and union type member comparison in a way to make obvious which comparisons are for field-decls and which are for the rest. LTO Profile-bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2011-05-30 Richard Guenther * gimple.c (gimple_types_compatible_p_1): Compare record and union type members properly. Index: gcc/gimple.c =================================================================== --- gcc/gimple.c (revision 174434) +++ gcc/gimple.c (working copy) @@ -3772,10 +3772,16 @@ gimple_types_compatible_p_1 (tree t1, tr f1 && f2; f1 = TREE_CHAIN (f1), f2 = TREE_CHAIN (f2)) { - /* The fields must have the same name, offset and type. */ + /* Different field kinds are not compatible. */ + if (TREE_CODE (f1) != TREE_CODE (f2)) + goto different_types; + /* Field decls must have the same name and offset. */ + if (TREE_CODE (f1) == FIELD_DECL + && (DECL_NONADDRESSABLE_P (f1) != DECL_NONADDRESSABLE_P (f2) + || !gimple_compare_field_offset (f1, f2))) + goto different_types; + /* All entities should have the same name and type. */ if (DECL_NAME (f1) != DECL_NAME (f2) - || DECL_NONADDRESSABLE_P (f1) != DECL_NONADDRESSABLE_P (f2) - || !gimple_compare_field_offset (f1, f2) || !gtc_visit (TREE_TYPE (f1), TREE_TYPE (f2), state, sccstack, sccstate, sccstate_obstack)) goto different_types;