From patchwork Tue May 17 12:12:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 95927 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 359E0B6EEB for ; Tue, 17 May 2011 22:13:15 +1000 (EST) Received: (qmail 6568 invoked by alias); 17 May 2011 12:13:10 -0000 Received: (qmail 6555 invoked by uid 22791); 17 May 2011 12:13:07 -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; Tue, 17 May 2011 12:12:46 +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 94C6C8FEA2 for ; Tue, 17 May 2011 14:12:44 +0200 (CEST) Date: Tue, 17 May 2011 14:12:44 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH][?/n] 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 fixes an oversight in the new SCC hash mixing code - we of course need to return the adjusted hash of our type, not the purely local one. There's still something weird going on, hash values somehow depend on the order we feed it types ... Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2011-05-17 Richard Guenther * gimple.c (iterative_hash_gimple_type): Simplify singleton case some more, fix final hash value of the non-singleton case. Index: gcc/gimple.c =================================================================== --- gcc/gimple.c (revision 173827) +++ gcc/gimple.c (working copy) @@ -4213,25 +4213,24 @@ iterative_hash_gimple_type (tree type, h if (state->low == state->dfsnum) { tree x; - struct sccs *cstate; struct tree_int_map *m; /* Pop off the SCC and set its hash values. */ x = VEC_pop (tree, *sccstack); - cstate = (struct sccs *)*pointer_map_contains (sccstate, x); - cstate->on_sccstack = false; /* Optimize SCC size one. */ if (x == type) { + state->on_sccstack = false; m = ggc_alloc_cleared_tree_int_map (); m->base.from = x; - m->to = cstate->u.hash; + m->to = v; slot = htab_find_slot (type_hash_cache, m, INSERT); gcc_assert (!*slot); *slot = (void *) m; } else { + struct sccs *cstate; unsigned first, i, size, j; struct type_hash_pair *pairs; /* Pop off the SCC and build an array of type, hash pairs. */ @@ -4241,6 +4240,8 @@ iterative_hash_gimple_type (tree type, h size = VEC_length (tree, *sccstack) - first + 1; pairs = XALLOCAVEC (struct type_hash_pair, size); i = 0; + cstate = (struct sccs *)*pointer_map_contains (sccstate, x); + cstate->on_sccstack = false; pairs[i].type = x; pairs[i].hash = cstate->u.hash; do @@ -4275,6 +4276,8 @@ iterative_hash_gimple_type (tree type, h for (j = 0; pairs[j].hash != pairs[i].hash; ++j) hash = iterative_hash_hashval_t (pairs[j].hash, hash); m->to = hash; + if (pairs[i].type == type) + v = hash; slot = htab_find_slot (type_hash_cache, m, INSERT); gcc_assert (!*slot); *slot = (void *) m;