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]

Re: Fix LTO streaming of BUILTINS_LOCATION


On Mon, 8 Jun 2015, Jan Hubicka wrote:

> Hi,
> currently we stream BUILTINS_LOCATION by expanding it and streaming resulting
> filename/line/col tripplet.  That is a nonsense and breaks some logic
> that special case it.
> 
> This patch fixes it by special casing it same way as we do UNKNOWN_LOCATION
> (we have precisely 2 special location codes, so doing compound bitpack is
> not needed)
> 
> Bootstrapped/regtested ppc64le-linux, OK?
> 
> Honza
> 
> 	* lto-streamer-out.c (lto_output_location): Correctly stream
> 	BUILTINS_LOCATION
> 	* lto-streamer-in (lto_input_location): Likewise.
> Index: lto-streamer-out.c
> ===================================================================
> --- lto-streamer-out.c	(revision 224201)
> +++ lto-streamer-out.c	(working copy)
> @@ -205,6 +205,9 @@
>    bp_pack_value (bp, loc == UNKNOWN_LOCATION, 1);
>    if (loc == UNKNOWN_LOCATION)
>      return;
> +  bp_pack_value (bp, loc == BUILTINS_LOCATION, 1);
> +  if (loc == BUILTINS_LOCATION)
> +    return;

Hmm, with this and

#define DECL_IS_BUILTIN(DECL) \
  (LOCATION_LOCUS (DECL_SOURCE_LOCATION (DECL)) <= BUILTINS_LOCATION)

shouldn't we rather stream all locations <= BUILTINS_LOCATION literally?
That is, instead of two bits stream a [0, BUILTINS_LOCATION+1] 'enum'
here?  Btw, line-map.h has RESERVED_LOCATION_COUNT for the locations
that are "special" (currently two, so your patch will work in practice).
  
>    xloc = expand_location (loc);
>  
> Index: lto-streamer-in.c
> ===================================================================
> --- lto-streamer-in.c	(revision 224201)
> +++ lto-streamer-in.c	(working copy)
> @@ -283,6 +283,11 @@
>        *loc = UNKNOWN_LOCATION;
>        return;
>      }
> +  if (bp_unpack_value (bp, 1))
> +    {
> +      *loc = BUILTINS_LOCATION;
> +      return;
> +    }
>    *loc = BUILTINS_LOCATION + 1;

Btw, this assignment to *loc looks odd (I suppose it's to make
location caching work).

Richard.

>    file_change = bp_unpack_value (bp, 1);
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg)


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