From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10898 invoked by alias); 22 Aug 2011 15:22:23 -0000 Received: (qmail 10881 invoked by uid 22791); 22 Aug 2011 15:22:21 -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) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Aug 2011 15:22:05 +0000 Received: from hpaq1.eem.corp.google.com (hpaq1.eem.corp.google.com [172.25.149.1]) by smtp-out.google.com with ESMTP id p7MFM3AD018254; Mon, 22 Aug 2011 08:22:03 -0700 Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by hpaq1.eem.corp.google.com with ESMTP id p7MFM0N8006760; Mon, 22 Aug 2011 08:22:01 -0700 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id 59EA41DA1CF; Mon, 22 Aug 2011 11:22:00 -0400 (EDT) To: reply@codereview.appspotmail.com, crowl@google.com, gchare@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Fix x1dynarra1, x1dynarray2a and x1dynarray2b (issue4921051) Message-Id: <20110822152200.59EA41DA1CF@topo.tor.corp.google.com> Date: Mon, 22 Aug 2011 15:50:00 -0000 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-08/txt/msg01785.txt.bz2 This patch fixes some template test cases. We were trying to expand functions that did not really need expanding (templates). This got me thinking that we are not approaching the expansion properly. We are trying to re-create all the cgraph creation done during the compilation of the header file. Rather than re-creating all this, it would be more efficient to save the state of the callgraph and varpool at the time of pph generation and then simply recreate it at read time. I will experiment with that, see if it actually makes any sense. Tested on x86_64. Applied to pph. * pph-streamer-out.c (pph_out_symtab): Mark the function as having a body if it has a cgraph node associated with it. * pph-streamer-in.c (pph_in_binding_level): Call pph_in_tree to read BL->BLOCKS. * pph-streamer-out.c (pph_out_binding_level_1): Call pph_out_tree to write BL->BLOCKS. testsuite/ChangeLog.pph 2011-08-18 Diego Novillo * g++.dg/pph/x1dynarray1.cc: Mark fixed. * g++.dg/pph/x1dynarray2a.cc: Mark fixed. * g++.dg/pph/x1dynarray2b.cc: Mark fixed. diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c index 9686edf..ae3ede9 100644 --- a/gcc/cp/pph-streamer-in.c +++ b/gcc/cp/pph-streamer-in.c @@ -557,7 +557,7 @@ pph_in_binding_level (pph_stream *stream, cp_binding_level *to_register) VEC_safe_push (cp_label_binding, gc, bl->shadowed_labels, sl); } - bl->blocks = pph_in_chain (stream); + bl->blocks = pph_in_tree (stream); bl->this_entity = pph_in_tree (stream); bl->level_chain = pph_in_binding_level (stream, NULL); bl->dead_vars_from_for = pph_in_tree_vec (stream); diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c index b563891..fe0758f 100644 --- a/gcc/cp/pph-streamer-out.c +++ b/gcc/cp/pph-streamer-out.c @@ -574,7 +574,7 @@ pph_out_binding_level_1 (pph_stream *stream, cp_binding_level *bl, FOR_EACH_VEC_ELT (cp_label_binding, bl->shadowed_labels, i, sl) pph_out_label_binding (stream, sl); - pph_out_chain (stream, bl->blocks); + pph_out_tree (stream, bl->blocks); pph_out_tree (stream, bl->this_entity); pph_out_binding_level (stream, bl->level_chain, filter); pph_out_tree_vec (stream, bl->dead_vars_from_for); @@ -1128,7 +1128,9 @@ pph_out_symtab (pph_stream *stream) FOR_EACH_VEC_ELT (tree, stream->symtab.v, i, decl) if (TREE_CODE (decl) == FUNCTION_DECL && DECL_STRUCT_FUNCTION (decl)) { - if (DECL_SAVED_TREE (decl)) + /* If this is a regular (non-template) function with a body, + mark it for expansion during reading. */ + if (DECL_SAVED_TREE (decl) && cgraph_get_node (decl)) pph_out_symtab_marker (stream, PPH_SYMTAB_FUNCTION_BODY); else pph_out_symtab_marker (stream, PPH_SYMTAB_FUNCTION); diff --git a/gcc/testsuite/g++.dg/pph/x1dynarray1.cc b/gcc/testsuite/g++.dg/pph/x1dynarray1.cc index 2a1f9f6..6ef279d 100644 --- a/gcc/testsuite/g++.dg/pph/x1dynarray1.cc +++ b/gcc/testsuite/g++.dg/pph/x1dynarray1.cc @@ -1,5 +1,4 @@ -// { dg-do link } -// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } +// { dg-do run } #include "x0dynarray1.h" diff --git a/gcc/testsuite/g++.dg/pph/x1dynarray2a.cc b/gcc/testsuite/g++.dg/pph/x1dynarray2a.cc index f941086..252e801 100644 --- a/gcc/testsuite/g++.dg/pph/x1dynarray2a.cc +++ b/gcc/testsuite/g++.dg/pph/x1dynarray2a.cc @@ -1,5 +1,4 @@ -// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-do link } +// { dg-do run } #include "x0dynarray2.h" diff --git a/gcc/testsuite/g++.dg/pph/x1dynarray2b.cc b/gcc/testsuite/g++.dg/pph/x1dynarray2b.cc index 8f14149..c942d9d 100644 --- a/gcc/testsuite/g++.dg/pph/x1dynarray2b.cc +++ b/gcc/testsuite/g++.dg/pph/x1dynarray2b.cc @@ -1,5 +1,4 @@ -// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-do link } +// { dg-do run } #include "x0dynarray2.h" -- 1.7.3.1 -- This patch is available for review at http://codereview.appspot.com/4921051