From patchwork Wed Mar 14 23:49:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 146788 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 A08F1B6EEE for ; Thu, 15 Mar 2012 10:49:58 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1332373798; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=0HSdsyG zJf8Zp3ap4eIeQ4f8/94=; b=ye6A2tQVrJSo6F70SJOa+czjxhDN1gf1Kx8VhrA 0oMk6IO9bcvHS0LaJpCY1MY7RK9gVTMkSpmoJ8pCm7prN0K9QUEgbbuM6wchh3V4 2iluJlG1dfBSjA7RdiK7vJQlWuV3tmZ/uXrqlkKwxvTtSkdDAwNPi+3ijb7TOwZh T70Y= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=VBFyEvgbnLWOpgfMZM/oBPEKY6sz7g4zvbhVM03RLZahQdnWN8Qbv22VzyNqWc R5AmXoM7WLqBMKVkNJLiPLtIFrdT7VU2n/u3qvS7BIL1wH+yXpHWBH4gjGoqWaOt iIfR018kmiALkPnTry4odmJRMvnzycN5PA5RIC3QXDbmE=; Received: (qmail 9044 invoked by alias); 14 Mar 2012 23:49:53 -0000 Received: (qmail 8969 invoked by uid 22791); 14 Mar 2012 23:49:51 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-yx0-f201.google.com (HELO mail-yx0-f201.google.com) (209.85.213.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Mar 2012 23:49:37 +0000 Received: by yenm6 with SMTP id m6so390569yen.2 for ; Wed, 14 Mar 2012 16:49:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=oHhSPxzNbO4n0iVjyRJWBJk7Rk/wK2EzIYSyo5MkP+k=; b=k/vx/gaj7iyA3Qna+DE5BQU+EoHIl0E1ngk4dyRajBsjp+fv3qNEbNFlDiMdbHbXs+ jmmmc6RTzErS/2WzSvSB7JGfwuB+StGAHcsBmC9a3tCKdNHYjfCceAoCoIPuy6vENPn7 N6k3bhYzcy6L8oMOQx8mipSq+LfsLKjsoeTgWNQwQweEdsuX/uWK1rTEd8OmtFsLQszP K7qTovakf8G1i+mFcyJGsuGPG0cVpmtO9rw7r1DSPnsnvCqPYoAptoB78hqGzjlm4ypL rXWHyC8acfUWgOhuxhRAdxfI1r6amBjGvA3Tc1IG30jLIJ9GXHxggcwt62EJnt9DXW0o 4Lkg== Received: by 10.236.145.135 with SMTP id p7mr6890457yhj.2.1331768976511; Wed, 14 Mar 2012 16:49:36 -0700 (PDT) Received: by 10.236.145.135 with SMTP id p7mr6890443yhj.2.1331768976427; Wed, 14 Mar 2012 16:49:36 -0700 (PDT) Received: from wpzn3.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id i36si58256anp.0.2012.03.14.16.49.36 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 14 Mar 2012 16:49:36 -0700 (PDT) Received: from tobiano.tor.corp.google.com (tobiano.tor.corp.google.com [172.29.41.6]) by wpzn3.hot.corp.google.com (Postfix) with ESMTP id 57D9E10004D; Wed, 14 Mar 2012 16:49:36 -0700 (PDT) Received: by tobiano.tor.corp.google.com (Postfix, from userid 54752) id A42DFAE1E4; Wed, 14 Mar 2012 19:49:35 -0400 (EDT) To: reply@codereview.appspotmail.com, crowl@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Identify and diagnose one class of bad merges (issue5822054) Message-Id: <20120314234935.A42DFAE1E4@tobiano.tor.corp.google.com> Date: Wed, 14 Mar 2012 19:49:35 -0400 (EDT) From: dnovillo@google.com (Diego Novillo) X-Gm-Message-State: ALoCoQmdltgtFY4SFASYs6a5gzlF1nLW9XXuw2cHvnWjaAJb5K3thEE24C3VMlJSSpG84tLKoOuWxorjkK9bTJD3de49XDmDKkuMwKWpccA2oKd6SuSD41qDugWBTNyiNswwWyQDT6lPYL+JJF6NmC1KlBAj4929o7nORaldEZhxJJFSySE+uXQ= X-IsSubscribed: yes 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 Detect one class of invalid merges. When merging two different EXPRs, we are currently merging some trees that should not be merged. This patch tries to identify one case where we can certainly detect that a bad merge is about to happen. This fixes no tests, but diagnoses quite a few bad merges in our internal testing. Lawrence will be producing test cases for those. 2012-03-14 Diego Novillo * pph-in.c (pph_in_merge_key_tree_with_searcher): Detect and diagnose attempts to merge two distinct trees from the same PPH image. --- This patch is available for review at http://codereview.appspot.com/5822054 diff --git a/gcc/cp/pph-in.c b/gcc/cp/pph-in.c index a328e13..ba89aa4 100644 --- a/gcc/cp/pph-in.c +++ b/gcc/cp/pph-in.c @@ -2625,7 +2625,23 @@ pph_in_merge_key_tree_with_searcher (pph_stream *stream, void *holder, gcc_assert (expr != NULL); if (expr != read_expr) - pph_merge_tree_attributes (expr, read_expr); + { + /* When STREAM was generated, EXPR and READ_EXPR were saved as + distinct trees (otherwise, we would have gotten READ_EXPR as + an internal reference). That's why we are reading them now as + distinct pointers. + + So, if we find that EXPR has already been registered in + STREAM's cache, it means that we should not be trying to + merge them. After all, the writer considered them different + objects. */ + if (pph_cache_lookup (&stream->cache, expr, NULL, + pph_tree_code_to_tag (expr))) + fatal_error ("Trying to merge distinct trees from the same " + "PPH image %s", stream->name); + + pph_merge_tree_attributes (expr, read_expr); + } pph_cache_insert_at (&stream->cache, expr, ix, pph_tree_code_to_tag (expr));