From patchwork Fri May 13 11:00:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 95460 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 2CB68B6EF3 for ; Fri, 13 May 2011 21:00:27 +1000 (EST) Received: (qmail 17282 invoked by alias); 13 May 2011 11:00:25 -0000 Received: (qmail 17273 invoked by uid 22791); 13 May 2011 11:00:24 -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; Fri, 13 May 2011 11:00:09 +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 916416CB00 for ; Fri, 13 May 2011 13:00:07 +0200 (CEST) Date: Fri, 13 May 2011 13:00:07 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR48978 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 The change to pointer and function type hashing has made hashing a lot weaker (contrary to what I expected) because if either type resides in a SCC then we do _not_ take the hash of the visited target types into account (I'm currently trying to think about a way around that), so we are effectively weakening the hashes by not hasing the target aggregate name. Committed to trunk. Richard. 2011-05-13 Richard Guenther PR lto/48978 * gimple.c (iterative_hash_gimple_type): Revert change in pointer target and function result and argument hashing. Index: gcc/gimple.c =================================================================== --- gcc/gimple.c (revision 173725) +++ gcc/gimple.c (working copy) @@ -4110,10 +4110,20 @@ iterative_hash_gimple_type (tree type, h } /* For pointer and reference types, fold in information about the type - pointed to. */ + pointed to but do not recurse into possibly incomplete types to + avoid hash differences for complete vs. incomplete types. */ if (POINTER_TYPE_P (type)) - v = visit (TREE_TYPE (type), state, v, - sccstack, sccstate, sccstate_obstack); + { + if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (type))) + { + v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v); + v = iterative_hash_name + (TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (type))), v); + } + else + v = visit (TREE_TYPE (type), state, v, + sccstack, sccstate, sccstate_obstack); + } /* For integer types hash the types min/max values and the string flag. */ if (TREE_CODE (type) == INTEGER_TYPE) @@ -4154,13 +4164,29 @@ iterative_hash_gimple_type (tree type, h v = visit (TYPE_METHOD_BASETYPE (type), state, v, sccstack, sccstate, sccstate_obstack); - /* Check result and argument types. */ - v = visit (TREE_TYPE (type), state, v, - sccstack, sccstate, sccstate_obstack); + /* For result types allow mismatch in completeness. */ + if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (type))) + { + v = iterative_hash_hashval_t (TREE_CODE (TREE_TYPE (type)), v); + v = iterative_hash_name + (TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (type))), v); + } + else + v = visit (TREE_TYPE (type), state, v, + sccstack, sccstate, sccstate_obstack); + for (p = TYPE_ARG_TYPES (type), na = 0; p; p = TREE_CHAIN (p)) { - v = visit (TREE_VALUE (p), state, v, - sccstack, sccstate, sccstate_obstack); + /* For argument types allow mismatch in completeness. */ + if (RECORD_OR_UNION_TYPE_P (TREE_VALUE (p))) + { + v = iterative_hash_hashval_t (TREE_CODE (TREE_VALUE (p)), v); + v = iterative_hash_name + (TYPE_NAME (TYPE_MAIN_VARIANT (TREE_VALUE (p))), v); + } + else + v = visit (TREE_VALUE (p), state, v, + sccstack, sccstate, sccstate_obstack); na++; }