This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Alternate fix for PR87229, fix PR88112


My previous fix for PR87229 was too aggressive.  The following
simply teaches the LTO streamer to deal with CALL_EXPRs, support
for which was already in place.  I've amended it with two
missing pieces, streaming of CALL_EXPR_BY_DESCRIPTOR and CALL_EXPR_IFN.

LTO bootstrapped and tested on x86_64-unknown-linux-gnu with Ada enabled.

Any objections?  As said elsewhere I'm looking for sth that is
reasonably safe for GCC 8 as well given the PR is a regression there.

Richard.

2018-11-21  Richard Biener  <rguenther@suse.de>

	PR lto/87229
	PR lto/88112
	* lto-streamer-out.c (lto_is_streamable): Allow CALL_EXPRs
	which can appear in size expressions.
	* tree-streamer-in.c (unpack_ts_base_value_fields): Stream
	CALL_EXPR_BY_DESCRIPTOR.
	(streamer_read_tree_bitfields): Stream CALL_EXPR_IFN.
	* tree-streamer-out.c (pack_ts_base_value_fields): Stream
	CALL_EXPR_BY_DESCRIPTOR.
	(streamer_write_tree_bitfields): Stream CALL_EXPR_IFN.

	Revert
	PR lto/87229
	* tree.c (free_lang_data_in_one_sizepos): Free non-gimple-val
	sizepos values.


Index: gcc/lto-streamer-out.c
===================================================================
--- gcc/lto-streamer-out.c	(revision 266308)
+++ gcc/lto-streamer-out.c	(working copy)
@@ -306,7 +306,6 @@ lto_is_streamable (tree expr)
      name version in lto_output_tree_ref (see output_ssa_names).  */
   return !is_lang_specific (expr)
 	 && code != SSA_NAME
-	 && code != CALL_EXPR
 	 && code != LANG_TYPE
 	 && code != MODIFY_EXPR
 	 && code != INIT_EXPR
Index: gcc/tree-streamer-in.c
===================================================================
--- gcc/tree-streamer-in.c	(revision 266308)
+++ gcc/tree-streamer-in.c	(working copy)
@@ -158,6 +158,11 @@ unpack_ts_base_value_fields (struct bitp
       SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1);
       bp_unpack_value (bp, 8);
     }
+  else if (TREE_CODE (expr) == CALL_EXPR)
+    {
+      CALL_EXPR_BY_DESCRIPTOR (expr) = (unsigned) bp_unpack_value (bp, 1);
+      bp_unpack_value (bp, 8);
+    }
   else
     bp_unpack_value (bp, 9);
 }
@@ -521,6 +526,8 @@ streamer_read_tree_bitfields (struct lto
 	    MR_DEPENDENCE_BASE (expr)
 	      = (unsigned)bp_unpack_value (&bp, sizeof (short) * 8);
 	}
+      else if (code == CALL_EXPR)
+	CALL_EXPR_IFN (expr) = bp_unpack_enum (&bp, internal_fn, IFN_LAST);
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
Index: gcc/tree-streamer-out.c
===================================================================
--- gcc/tree-streamer-out.c	(revision 266308)
+++ gcc/tree-streamer-out.c	(working copy)
@@ -129,6 +129,11 @@ pack_ts_base_value_fields (struct bitpac
       bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1);
       bp_pack_value (bp, 0, 8);
     }
+  else if (TREE_CODE (expr) == CALL_EXPR)
+    {
+      bp_pack_value (bp, CALL_EXPR_BY_DESCRIPTOR (expr), 1);
+      bp_pack_value (bp, 0, 8);
+    }
   else
     bp_pack_value (bp, 0, 9);
 }
@@ -457,6 +462,8 @@ streamer_write_tree_bitfields (struct ou
 	  if (MR_DEPENDENCE_CLIQUE (expr) != 0)
 	    bp_pack_value (&bp, MR_DEPENDENCE_BASE (expr), sizeof (short) * 8);
 	}
+      else if (code == CALL_EXPR)
+	bp_pack_enum (&bp, internal_fn, IFN_LAST, CALL_EXPR_IFN (expr));
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 266308)
+++ gcc/tree.c	(working copy)
@@ -5254,13 +5254,6 @@ free_lang_data_in_one_sizepos (tree *exp
   tree expr = *expr_p;
   if (CONTAINS_PLACEHOLDER_P (expr))
     *expr_p = build0 (PLACEHOLDER_EXPR, TREE_TYPE (expr));
-  /* ???  We have to reset all non-GIMPLE sizepos because those eventually
-     refer to trees we cannot stream.  See for example PR87229 which
-     shows an example with non-gimplified abstract origins in C++.
-     Note this should only happen for abstract copies so setting sizes
-     to NULL is OK (but we cannot easily assert this).  */
-  else if (expr && !is_gimple_val (expr))
-    *expr_p = NULL_TREE;
 }
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]