public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] lto: Remove stream_input_location_now
@ 2020-09-04  8:49 Jakub Jelinek
  2020-09-04  9:33 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2020-09-04  8:49 UTC (permalink / raw)
  To: Richard Biener, Jan Hubicka; +Cc: gcc-patches

Hi!

As discussed yesterday, stream_input_location_now has been used in 3
remaining places.  For ERT_MUST_NOT_THROW, I believe the failure_loc
location is stable at least until the apply_cache after the bbs are all
read, and the locations do not include BLOCK, so we can use normal
stream_input_location, and the two input_struct_function_base also
shouldn't include BLOCK and are stable at least until that same apply_cache
after reading all bbs, so again we can use the location cache.

Bootstrapped/regtested on x86_64-linux and i686-linux, and lto bootstrapped
on x86_64-linux, ok for trunk?

2020-09-03  Jakub Jelinek  <jakub@redhat.com>

	* lto-streamer.h (stream_input_location_now): Remove declaration.
	* lto-streamer-in.c (stream_input_location_now): Remove.
	(input_eh_region, input_struct_function_base): Use
	stream_input_location instead of stream_input_location_now.

--- gcc/lto-streamer.h.jj	2020-09-03 20:10:13.753993705 +0200
+++ gcc/lto-streamer.h	2020-09-03 20:18:59.209362865 +0200
@@ -853,8 +853,6 @@ extern class data_in *lto_data_in_create
 extern void lto_data_in_delete (class data_in *);
 extern void lto_input_data_block (class lto_input_block *, void *, size_t);
 void lto_input_location (location_t *, struct bitpack_d *, class data_in *);
-location_t stream_input_location_now (struct bitpack_d *bp,
-				      class data_in *data);
 tree lto_input_tree_ref (class lto_input_block *, class data_in *,
 			 struct function *, enum LTO_tags);
 void lto_tag_check_set (enum LTO_tags, int, ...);
--- gcc/lto-streamer-in.c.jj	2020-09-03 20:10:13.751993734 +0200
+++ gcc/lto-streamer-in.c	2020-09-03 20:20:03.307432156 +0200
@@ -351,19 +351,6 @@ lto_input_location (location_t *loc, str
   data_in->location_cache.input_location (loc, bp, data_in);
 }
 
-/* Read location and return it instead of going through location caching.
-   This should be used only when the resulting location is not going to be
-   discarded.  */
-
-location_t
-stream_input_location_now (struct bitpack_d *bp, class data_in *data_in)
-{
-  location_t loc;
-  stream_input_location (&loc, bp, data_in);
-  data_in->location_cache.apply_location_cache ();
-  return loc;
-}
-
 /* Read a reference to a tree node from DATA_IN using input block IB.
    TAG is the expected node that should be found in IB, if TAG belongs
    to one of the indexable trees, expect to read a reference index to
@@ -527,8 +514,8 @@ input_eh_region (class lto_input_block *
 	  r->type = ERT_MUST_NOT_THROW;
 	  r->u.must_not_throw.failure_decl = stream_read_tree (ib, data_in);
 	  bitpack_d bp = streamer_read_bitpack (ib);
-	  r->u.must_not_throw.failure_loc
-	   = stream_input_location_now (&bp, data_in);
+	  stream_input_location (&r->u.must_not_throw.failure_loc,
+	  			 &bp, data_in);
 	}
 	break;
 
@@ -1059,8 +1046,8 @@ input_struct_function_base (struct funct
   fn->last_clique = bp_unpack_value (&bp, sizeof (short) * 8);
 
   /* Input the function start and end loci.  */
-  fn->function_start_locus = stream_input_location_now (&bp, data_in);
-  fn->function_end_locus = stream_input_location_now (&bp, data_in);
+  stream_input_location (&fn->function_start_locus, &bp, data_in);
+  stream_input_location (&fn->function_end_locus, &bp, data_in);
 
   /* Restore the instance discriminators if present.  */
   int instance_number = bp_unpack_value (&bp, 1);

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] lto: Remove stream_input_location_now
  2020-09-04  8:49 [PATCH] lto: Remove stream_input_location_now Jakub Jelinek
@ 2020-09-04  9:33 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2020-09-04  9:33 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Jan Hubicka, gcc-patches

On Fri, 4 Sep 2020, Jakub Jelinek wrote:

> Hi!
> 
> As discussed yesterday, stream_input_location_now has been used in 3
> remaining places.  For ERT_MUST_NOT_THROW, I believe the failure_loc
> location is stable at least until the apply_cache after the bbs are all
> read, and the locations do not include BLOCK, so we can use normal
> stream_input_location, and the two input_struct_function_base also
> shouldn't include BLOCK and are stable at least until that same apply_cache
> after reading all bbs, so again we can use the location cache.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, and lto bootstrapped
> on x86_64-linux, ok for trunk?

OK.

Thanks,
Richard.

> 2020-09-03  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* lto-streamer.h (stream_input_location_now): Remove declaration.
> 	* lto-streamer-in.c (stream_input_location_now): Remove.
> 	(input_eh_region, input_struct_function_base): Use
> 	stream_input_location instead of stream_input_location_now.
> 
> --- gcc/lto-streamer.h.jj	2020-09-03 20:10:13.753993705 +0200
> +++ gcc/lto-streamer.h	2020-09-03 20:18:59.209362865 +0200
> @@ -853,8 +853,6 @@ extern class data_in *lto_data_in_create
>  extern void lto_data_in_delete (class data_in *);
>  extern void lto_input_data_block (class lto_input_block *, void *, size_t);
>  void lto_input_location (location_t *, struct bitpack_d *, class data_in *);
> -location_t stream_input_location_now (struct bitpack_d *bp,
> -				      class data_in *data);
>  tree lto_input_tree_ref (class lto_input_block *, class data_in *,
>  			 struct function *, enum LTO_tags);
>  void lto_tag_check_set (enum LTO_tags, int, ...);
> --- gcc/lto-streamer-in.c.jj	2020-09-03 20:10:13.751993734 +0200
> +++ gcc/lto-streamer-in.c	2020-09-03 20:20:03.307432156 +0200
> @@ -351,19 +351,6 @@ lto_input_location (location_t *loc, str
>    data_in->location_cache.input_location (loc, bp, data_in);
>  }
>  
> -/* Read location and return it instead of going through location caching.
> -   This should be used only when the resulting location is not going to be
> -   discarded.  */
> -
> -location_t
> -stream_input_location_now (struct bitpack_d *bp, class data_in *data_in)
> -{
> -  location_t loc;
> -  stream_input_location (&loc, bp, data_in);
> -  data_in->location_cache.apply_location_cache ();
> -  return loc;
> -}
> -
>  /* Read a reference to a tree node from DATA_IN using input block IB.
>     TAG is the expected node that should be found in IB, if TAG belongs
>     to one of the indexable trees, expect to read a reference index to
> @@ -527,8 +514,8 @@ input_eh_region (class lto_input_block *
>  	  r->type = ERT_MUST_NOT_THROW;
>  	  r->u.must_not_throw.failure_decl = stream_read_tree (ib, data_in);
>  	  bitpack_d bp = streamer_read_bitpack (ib);
> -	  r->u.must_not_throw.failure_loc
> -	   = stream_input_location_now (&bp, data_in);
> +	  stream_input_location (&r->u.must_not_throw.failure_loc,
> +	  			 &bp, data_in);
>  	}
>  	break;
>  
> @@ -1059,8 +1046,8 @@ input_struct_function_base (struct funct
>    fn->last_clique = bp_unpack_value (&bp, sizeof (short) * 8);
>  
>    /* Input the function start and end loci.  */
> -  fn->function_start_locus = stream_input_location_now (&bp, data_in);
> -  fn->function_end_locus = stream_input_location_now (&bp, data_in);
> +  stream_input_location (&fn->function_start_locus, &bp, data_in);
> +  stream_input_location (&fn->function_end_locus, &bp, data_in);
>  
>    /* Restore the instance discriminators if present.  */
>    int instance_number = bp_unpack_value (&bp, 1);
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-04  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04  8:49 [PATCH] lto: Remove stream_input_location_now Jakub Jelinek
2020-09-04  9:33 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).