From patchwork Wed Oct 12 02:35:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 119102 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 6F6CCB6F62 for ; Wed, 12 Oct 2011 13:35:34 +1100 (EST) Received: (qmail 16632 invoked by alias); 12 Oct 2011 02:35:31 -0000 Received: (qmail 16514 invoked by uid 22791); 12 Oct 2011 02:35:30 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Oct 2011 02:35:14 +0000 Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id p9C2ZCg5025901; Tue, 11 Oct 2011 19:35:12 -0700 Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by wpaz21.hot.corp.google.com with ESMTP id p9C2ZAJA021423; Tue, 11 Oct 2011 19:35:10 -0700 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id 543201DA1D2; Tue, 11 Oct 2011 22:35:10 -0400 (EDT) To: reply@codereview.appspotmail.com, crowl@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Fix handling of AGGR_INIT_EXPRs (issue5246056) Message-Id: <20111012023510.543201DA1D2@topo.tor.corp.google.com> Date: Tue, 11 Oct 2011 22:35:10 -0400 (EDT) From: dnovillo@google.com (Diego Novillo) X-System-Of-Record: true 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 We were not saving enough data in the header of AGGR_INIT_EXPRs. This does not fix any failures yet (the test case that uses these is failing due to merging). Tested on x86_64. Diego. * pph-streamer-in.c (pph_read_tree_header): Handle AGGR_INIT_EXPR. * pph-streamer-out.c (pph_write_tree_header): Likewise. --- This patch is available for review at http://codereview.appspot.com/5246056 diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c index ffa1433..1541ef9 100644 --- a/gcc/cp/pph-streamer-in.c +++ b/gcc/cp/pph-streamer-in.c @@ -1932,9 +1932,17 @@ pph_read_tree_header (pph_stream *stream, enum LTO_tags tag) struct data_in *data_in = stream->encoder.r.data_in; struct bitpack_d bp; tree expr; + enum tree_code code; - /* Allocate the tree. */ - expr = streamer_alloc_tree (ib, data_in, tag); + /* Allocate the tree. Handle C++-specific codes first. */ + code = lto_tag_to_tree_code (tag); + if (code == AGGR_INIT_EXPR) + { + unsigned nargs = pph_in_uint (stream); + expr = build_vl_exp (AGGR_INIT_EXPR, nargs + 3); + } + else + expr = streamer_alloc_tree (ib, data_in, tag); /* Read the language-independent bitfields for EXPR. */ bp = streamer_read_tree_bitfields (ib, expr); diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c index 6a8db20..97566fd 100644 --- a/gcc/cp/pph-streamer-out.c +++ b/gcc/cp/pph-streamer-out.c @@ -1893,6 +1893,11 @@ pph_write_tree_header (pph_stream *stream, tree expr) on the reading side. */ streamer_write_tree_header (ob, expr); + /* Process C++ specific codes that need more data in the header + for the reader to allocate them. */ + if (TREE_CODE (expr) == AGGR_INIT_EXPR) + pph_out_uint (stream, aggr_init_expr_nargs (expr)); + /* Pack all the non-pointer fields in EXPR into a bitpack and write the resulting bitpack. */ bp = bitpack_create (ob->main_stream);