Patchwork [pph] Fix handling of AGGR_INIT_EXPRs (issue5246056)

login
register
mail settings
Submitter Diego Novillo
Date Oct. 12, 2011, 2:35 a.m.
Message ID <20111012023510.543201DA1D2@topo.tor.corp.google.com>
Download mbox | patch
Permalink /patch/119102/
State New
Headers show

Comments

Diego Novillo - Oct. 12, 2011, 2:35 a.m.
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

Patch

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);