PR c++/68795: fix uninitialized close_paren_loc in cp_parser_postfix_expression
[gcc.git] / gcc / lto-streamer.h
index a53e2535968ce623d3fa5382c57743843fe818d7..42654f5f26635ed77bee0ce2d27603d2a1fb0c8f 100644 (file)
@@ -1,7 +1,7 @@
 /* Data structures and declarations used for reading and writing
    GIMPLE to a file stream.
 
-   Copyright (C) 2009-2014 Free Software Foundation, Inc.
+   Copyright (C) 2009-2016 Free Software Foundation, Inc.
    Contributed by Doug Kwan <dougkwan@google.com>
 
 This file is part of GCC.
@@ -24,14 +24,8 @@ along with GCC; see the file COPYING3.  If not see
 #define GCC_LTO_STREAMER_H
 
 #include "plugin-api.h"
-#include "hash-table.h"
-#include "target.h"
-#include "cgraph.h"
-#include "vec.h"
-#include "alloc-pool.h"
 #include "gcov-io.h"
 #include "diagnostic.h"
-#include "pointer-set.h"
 
 /* Define when debugging the LTO streamer.  This causes the writer
    to output the numeric value for the memory address of the tree node
@@ -134,13 +128,7 @@ along with GCC; see the file COPYING3.  If not see
      String are represented in the table as pairs, a length in ULEB128
      form followed by the data for the string.  */
 
-/* The string that is the prefix on the section names we make for lto.
-   For decls the DECL_ASSEMBLER_NAME is appended to make the section
-   name for the functions and static_initializers.  For other types of
-   sections a '.' and the section type are appended.  */
-#define LTO_SECTION_NAME_PREFIX         ".gnu.lto_"
-
-#define LTO_major_version 3
+#define LTO_major_version 5
 #define LTO_minor_version 0
 
 typedef unsigned char  lto_decl_flags_t;
@@ -253,6 +241,9 @@ enum lto_section_type
   LTO_section_cgraph_opt_sum,
   LTO_section_inline_summary,
   LTO_section_ipcp_transform,
+  LTO_section_ipa_icf,
+  LTO_section_offload_table,
+  LTO_section_mode_table,
   LTO_N_SECTION_TYPES          /* Must be last.  */
 };
 
@@ -280,15 +271,14 @@ lto_file_decl_data_get_ ## name (struct lto_file_decl_data *data, \
                                 unsigned int idx) \
 { \
   struct lto_in_decl_state *state = data->current_decl_state; \
-  gcc_assert (idx < state->streams[LTO_DECL_STREAM_## UPPER_NAME].size); \
-  return state->streams[LTO_DECL_STREAM_## UPPER_NAME].trees[idx]; \
+   return (*state->streams[LTO_DECL_STREAM_## UPPER_NAME])[idx]; \
 } \
 \
 static inline unsigned int \
 lto_file_decl_data_num_ ## name ## s (struct lto_file_decl_data *data) \
 { \
   struct lto_in_decl_state *state = data->current_decl_state; \
-  return state->streams[LTO_DECL_STREAM_## UPPER_NAME].size; \
+  return vec_safe_length (state->streams[LTO_DECL_STREAM_## UPPER_NAME]); \
 }
 
 
@@ -312,28 +302,92 @@ typedef void (lto_free_section_data_f) (struct lto_file_decl_data *,
                                        const char *,
                                        size_t);
 
+/* The location cache holds expanded locations for streamed in trees.
+   This is done to reduce memory usage of libcpp linemap that strongly preffers
+   locations to be inserted in the soruce order.  */
+
+class lto_location_cache
+{
+public:
+  /* Apply all changes in location cache.  Add locations into linemap and patch
+     trees.  */
+  bool apply_location_cache ();
+  /* Tree merging did not suceed; mark all changes in the cache as accepted.  */
+  void accept_location_cache ();
+  /* Tree merging did suceed; throw away recent changes.  */
+  void revert_location_cache ();
+  void input_location (location_t *loc, struct bitpack_d *bp,
+                      struct data_in *data_in);
+  lto_location_cache ()
+     : loc_cache (), accepted_length (0), current_file (NULL), current_line (0),
+       current_col (0), current_sysp (false), current_loc (UNKNOWN_LOCATION)
+  {
+    gcc_assert (!current_cache);
+    current_cache = this;
+  }
+  ~lto_location_cache ()
+  {
+    apply_location_cache ();
+    gcc_assert (current_cache == this);
+    current_cache = NULL;
+  }
+
+  /* There can be at most one instance of location cache (combining multiple
+     would bring it out of sync with libcpp linemap); point to current
+     one.  */
+  static lto_location_cache *current_cache;
+  
+private:
+  static int cmp_loc (const void *pa, const void *pb);
+
+  struct cached_location
+  {
+    const char *file;
+    location_t *loc;
+    int line, col;
+    bool sysp;
+  };
+
+  /* The location cache.  */
+
+  auto_vec<cached_location> loc_cache;
+
+  /* Accepted entries are ones used by trees that are known to be not unified
+     by tree merging.  */
+
+  int accepted_length;
+
+  /* Bookkeeping to remember state in between calls to lto_apply_location_cache
+     When streaming gimple, the location cache is not used and thus
+     lto_apply_location_cache happens per location basis.  It is then
+     useful to avoid redundant calls of linemap API.  */
+
+  const char *current_file;
+  int current_line;
+  int current_col;
+  bool current_sysp;
+  location_t current_loc;
+};
+
 /* Structure used as buffer for reading an LTO file.  */
-struct lto_input_block
+class lto_input_block
 {
+public:
+  /* Special constructor for the string table, it abuses this to
+     do random access but use the uhwi decoder.  */
+  lto_input_block (const char *data_, unsigned int p_, unsigned int len_,
+                  const unsigned char *mode_table_)
+      : data (data_), mode_table (mode_table_), p (p_), len (len_) {}
+  lto_input_block (const char *data_, unsigned int len_,
+                  const unsigned char *mode_table_)
+      : data (data_), mode_table (mode_table_), p (0), len (len_) {}
+
   const char *data;
+  const unsigned char *mode_table;
   unsigned int p;
   unsigned int len;
 };
 
-#define LTO_INIT_INPUT_BLOCK(BASE,D,P,L)   \
-  do {                                     \
-    BASE.data = D;                         \
-    BASE.p = P;                            \
-    BASE.len = L;                          \
-  } while (0)
-
-#define LTO_INIT_INPUT_BLOCK_PTR(BASE,D,P,L) \
-  do {                                       \
-    BASE->data = D;                          \
-    BASE->p = P;                             \
-    BASE->len = L;                           \
-  } while (0)
-
 
 /* The is the first part of the record for a function or constructor
    in the .o file.  */
@@ -343,69 +397,36 @@ struct lto_header
   int16_t minor_version;
 };
 
-/* The header for a function body.  */
-struct lto_function_header
+/* The is the first part of the record in an LTO file for many of the
+   IPA passes.  */
+struct lto_simple_header : lto_header
 {
-  /* The header for all types of sections. */
-  struct lto_header lto_header;
-
-  /* Number of labels with names.  */
-  int32_t num_named_labels;
-
-  /* Number of labels without names.  */
-  int32_t num_unnamed_labels;
-
-  /* Size compressed or 0 if not compressed.  */
-  int32_t compressed_size;
-
-  /* Size of names for named labels.  */
-  int32_t named_label_size;
-
-  /* Size of the cfg.  */
-  int32_t cfg_size;
-
   /* Size of main gimple body of function.  */
   int32_t main_size;
+};
 
+struct lto_simple_header_with_strings : lto_simple_header
+{
   /* Size of the string table.  */
   int32_t string_size;
 };
 
+/* The header for a function body.  */
+struct lto_function_header : lto_simple_header_with_strings
+{
+  /* Size of the cfg.  */
+  int32_t cfg_size;
+};
+
 
 /* Structure describing a symbol section.  */
-struct lto_decl_header
+struct lto_decl_header : lto_simple_header_with_strings
 {
-  /* The header for all types of sections. */
-  struct lto_header lto_header;
-
   /* Size of region for decl state. */
   int32_t decl_state_size;
 
   /* Number of nodes in globals stream.  */
   int32_t num_nodes;
-
-  /* Size of region for expressions, decls, types, etc. */
-  int32_t main_size;
-
-  /* Size of the string table.  */
-  int32_t string_size;
-};
-
-
-/* Structure describing top level asm()s.  */
-struct lto_asm_header
-{
-  /* The header for all types of sections. */
-  struct lto_header lto_header;
-
-  /* Size compressed or 0 if not compressed.  */
-  int32_t compressed_size;
-
-  /* Size of region for expressions, decls, types, etc. */
-  int32_t main_size;
-
-  /* Size of the string table.  */
-  int32_t string_size;
 };
 
 
@@ -448,7 +469,7 @@ struct lto_encoder_entry
 struct lto_symtab_encoder_d
 {
   vec<lto_encoder_entry> nodes;
-  pointer_map_t *map;
+  hash_map<symtab_node *, size_t> *map;
 };
 
 typedef struct lto_symtab_encoder_d *lto_symtab_encoder_t;
@@ -462,40 +483,45 @@ struct lto_symtab_encoder_iterator
 
 
 
-
-/* Mapping from indices to trees.  */
-struct GTY(()) lto_tree_ref_table
-{
-  /* Array of referenced trees . */
-  tree * GTY((length ("%h.size"))) trees;
-
-  /* Size of array. */
-  unsigned int size;
-};
-
-
 /* The lto_tree_ref_encoder struct is used to encode trees into indices. */
 
 struct lto_tree_ref_encoder
 {
-  pointer_map<unsigned> *tree_hash_table;      /* Maps pointers to indices. */
+  hash_map<tree, unsigned> *tree_hash_table;   /* Maps pointers to indices. */
   vec<tree> trees;                     /* Maps indices to pointers. */
 };
 
 
 /* Structure to hold states of input scope.  */
-struct GTY(()) lto_in_decl_state
+struct GTY((for_user)) lto_in_decl_state
 {
   /* Array of lto_in_decl_buffers to store type and decls streams. */
-  struct lto_tree_ref_table streams[LTO_N_DECL_STREAMS];
+  vec<tree, va_gc> *streams[LTO_N_DECL_STREAMS];
 
   /* If this in-decl state is associated with a function. FN_DECL
      point to the FUNCTION_DECL. */
   tree fn_decl;
+
+  /* True if decl state is compressed.  */
+  bool compressed;
 };
 
 typedef struct lto_in_decl_state *lto_in_decl_state_ptr;
 
+struct decl_state_hasher : ggc_ptr_hash<lto_in_decl_state>
+{
+  static hashval_t
+  hash (lto_in_decl_state *s)
+  {
+    return htab_hash_pointer (s->fn_decl);
+  }
+
+  static bool
+  equal (lto_in_decl_state *a, lto_in_decl_state *b)
+  {
+    return a->fn_decl == b->fn_decl;
+  }
+};
 
 /* The structure that holds all of the vectors of global types,
    decls and cgraph nodes used in the serialization of this file.  */
@@ -511,6 +537,9 @@ struct lto_out_decl_state
   /* If this out-decl state belongs to a function, fn_decl points to that
      function.  Otherwise, it is NULL. */
   tree fn_decl;
+
+  /* True if decl state is compressed.  */
+  bool compressed;
 };
 
 typedef struct lto_out_decl_state *lto_out_decl_state_ptr;
@@ -542,7 +571,7 @@ struct GTY(()) lto_file_decl_data
   lto_symtab_encoder_t GTY((skip)) symtab_node_encoder;
 
   /* Hash table maps lto-related section names to location in file.  */
-  htab_t GTY((param_is (struct lto_in_decl_state))) function_decl_states;
+  hash_table<decl_state_hasher> *function_decl_states;
 
   /* The .o file that these offsets relate to.  */
   const char *GTY((skip)) file_name;
@@ -566,7 +595,10 @@ struct GTY(()) lto_file_decl_data
   struct gcov_ctr_summary GTY((skip)) profile_info;
 
   /* Map assigning declarations their resolutions.  */
-  pointer_map_t * GTY((skip)) resolution_map;
+  hash_map<tree, ld_plugin_symbol_resolution> * GTY((skip)) resolution_map;
+
+  /* Mode translation table.  */
+  const unsigned char *mode_table;
 };
 
 typedef struct lto_file_decl_data *lto_file_decl_data_ptr;
@@ -601,20 +633,6 @@ struct lto_output_stream
   unsigned int total_size;
 };
 
-/* The is the first part of the record in an LTO file for many of the
-   IPA passes.  */
-struct lto_simple_header
-{
-  /* The header for all types of sections. */
-  struct lto_header lto_header;
-
-  /* Size of main gimple body of function.  */
-  int32_t main_size;
-
-  /* Size of main stream when compressed.  */
-  int32_t compressed_size;
-};
-
 /* A simple output block.  This can be used for simple IPA passes that
    do not need more than one stream.  */
 struct lto_simple_output_block
@@ -637,19 +655,17 @@ struct string_slot
 
 /* Hashtable helpers.  */
 
-struct string_slot_hasher : typed_noop_remove <string_slot>
+struct string_slot_hasher : nofree_ptr_hash <string_slot>
 {
-  typedef string_slot value_type;
-  typedef string_slot compare_type;
-  static inline hashval_t hash (const value_type *);
-  static inline bool equal (const value_type *, const compare_type *);
+  static inline hashval_t hash (const string_slot *);
+  static inline bool equal (const string_slot *, const string_slot *);
 };
 
 /* Returns a hash code for DS.  Adapted from libiberty's htab_hash_string
    to support strings that may not end in '\0'.  */
 
 inline hashval_t
-string_slot_hasher::hash (const value_type *ds)
+string_slot_hasher::hash (const string_slot *ds)
 {
   hashval_t r = ds->len;
   int i;
@@ -662,7 +678,7 @@ string_slot_hasher::hash (const value_type *ds)
 /* Returns nonzero if DS1 and DS2 are equal.  */
 
 inline bool
-string_slot_hasher::equal (const value_type *ds1, const compare_type *ds2)
+string_slot_hasher::equal (const string_slot *ds1, const string_slot *ds2)
 {
   if (ds1->len == ds2->len)
     return memcmp (ds1->s, ds2->s, ds1->len) == 0;
@@ -688,11 +704,11 @@ struct output_block
 
   /* The hash table that contains the set of strings we have seen so
      far and the indexes assigned to them.  */
-  hash_table <string_slot_hasher> string_hash_table;
+  hash_table<string_slot_hasher> *string_hash_table;
 
-  /* The current cgraph_node that we are currently serializing.  Null
+  /* The current symbol that we are currently serializing.  Null
      if we are serializing something else.  */
-  struct cgraph_node *cgraph_node;
+  symtab_node *symbol;
 
   /* These are the last file and line that were seen in the stream.
      If the current node differs from these, it needs to insert
@@ -700,9 +716,7 @@ struct output_block
   const char *current_file;
   int current_line;
   int current_col;
-
-  /* True if writing globals and types.  */
-  bool global;
+  bool current_sysp;
 
   /* Cache of nodes written in this section.  */
   struct streamer_tree_cache_d *writer_cache;
@@ -719,27 +733,20 @@ struct data_in
   /* The global decls and types.  */
   struct lto_file_decl_data *file_data;
 
-  /* All of the labels.  */
-  tree *labels;
-
   /* The string table.  */
   const char *strings;
 
   /* The length of the string table.  */
   unsigned int strings_len;
 
-  /* Number of named labels.  Used to find the index of unnamed labels
-     since they share space with the named labels.  */
-  unsigned int num_named_labels;
-
-  /* Number of unnamed labels.  */
-  unsigned int num_unnamed_labels;
-
   /* Maps each reference number to the resolution done by the linker. */
   vec<ld_plugin_symbol_resolution_t> globals_resolution;
 
   /* Cache of pickled nodes.  */
   struct streamer_tree_cache_d *reader_cache;
+
+  /* Cache of source code location.  */
+  lto_location_cache location_cache;
 };
 
 
@@ -757,10 +764,18 @@ extern void lto_set_in_hooks (struct lto_file_decl_data **,
 extern struct lto_file_decl_data **lto_get_file_decl_data (void);
 extern const char *lto_get_section_data (struct lto_file_decl_data *,
                                         enum lto_section_type,
-                                        const char *, size_t *);
+                                        const char *, size_t *,
+                                        bool decompress = false);
+extern const char *lto_get_raw_section_data (struct lto_file_decl_data *,
+                                            enum lto_section_type,
+                                            const char *, size_t *);
 extern void lto_free_section_data (struct lto_file_decl_data *,
-                                  enum lto_section_type,
-                                  const char *, const char *, size_t);
+                                  enum lto_section_type,
+                                  const char *, const char *, size_t,
+                                  bool decompress = false);
+extern void lto_free_raw_section_data (struct lto_file_decl_data *,
+                                      enum lto_section_type,
+                                      const char *, const char *, size_t);
 extern htab_t lto_create_renaming_table (void);
 extern void lto_record_renamed_decl (struct lto_file_decl_data *,
                                     const char *, const char *);
@@ -768,8 +783,6 @@ extern const char *lto_get_decl_name_mapping (struct lto_file_decl_data *,
                                              const char *);
 extern struct lto_in_decl_state *lto_new_in_decl_state (void);
 extern void lto_delete_in_decl_state (struct lto_in_decl_state *);
-extern hashval_t lto_hash_in_decl_state (const void *);
-extern int lto_eq_in_decl_state (const void *, const void *);
 extern struct lto_in_decl_state *lto_get_function_in_decl_state (
                                      struct lto_file_decl_data *, tree);
 extern void lto_free_function_in_decl_state (struct lto_in_decl_state *);
@@ -782,9 +795,9 @@ extern void lto_value_range_error (const char *,
 /* In lto-section-out.c  */
 extern void lto_begin_section (const char *, bool);
 extern void lto_end_section (void);
+extern void lto_write_data (const void *, unsigned int);
+extern void lto_write_raw_data (const void *, unsigned int);
 extern void lto_write_stream (struct lto_output_stream *);
-extern void lto_output_data_stream (struct lto_output_stream *, const void *,
-                                   size_t);
 extern bool lto_output_decl_index (struct lto_output_stream *,
                            struct lto_tree_ref_encoder *,
                            tree, unsigned int *);
@@ -814,6 +827,10 @@ extern void lto_append_block (struct lto_output_stream *);
 
 
 /* In lto-streamer.c.  */
+
+/* Set when streaming LTO for offloading compiler.  */
+extern bool lto_stream_offload_p;
+
 extern const char *lto_tag_name (enum LTO_tags);
 extern bitmap lto_bitmap_alloc (void);
 extern void lto_bitmap_free (bitmap);
@@ -835,15 +852,21 @@ extern void lto_reader_init (void);
 extern void lto_input_function_body (struct lto_file_decl_data *,
                                     struct cgraph_node *,
                                     const char *);
+extern void lto_input_variable_constructor (struct lto_file_decl_data *,
+                                           struct varpool_node *,
+                                           const char *);
 extern void lto_input_constructors_and_inits (struct lto_file_decl_data *,
                                              const char *);
 extern void lto_input_toplevel_asms (struct lto_file_decl_data *, int);
+extern void lto_input_mode_table (struct lto_file_decl_data *);
 extern struct data_in *lto_data_in_create (struct lto_file_decl_data *,
                                    const char *, unsigned,
                                    vec<ld_plugin_symbol_resolution_t> );
 extern void lto_data_in_delete (struct data_in *);
 extern void lto_input_data_block (struct lto_input_block *, void *, size_t);
-location_t lto_input_location (struct bitpack_d *, struct data_in *);
+void lto_input_location (location_t *, struct bitpack_d *, struct data_in *);
+location_t stream_input_location_now (struct bitpack_d *bp,
+                                     struct data_in *data);
 tree lto_input_tree_ref (struct lto_input_block *, struct data_in *,
                         struct function *, enum LTO_tags);
 void lto_tag_check_set (enum LTO_tags, int, ...);
@@ -870,9 +893,11 @@ void lto_output_decl_state_refs (struct output_block *,
                                 struct lto_output_stream *,
                                 struct lto_out_decl_state *);
 void lto_output_location (struct output_block *, struct bitpack_d *, location_t);
+void lto_output_init_mode_table (void);
 
 
 /* In lto-cgraph.c  */
+extern bool asm_nodes_output;
 lto_symtab_encoder_t lto_symtab_encoder_new (bool);
 int lto_symtab_encoder_encode (lto_symtab_encoder_t, symtab_node *);
 void lto_symtab_encoder_delete (lto_symtab_encoder_t);
@@ -888,21 +913,31 @@ bool lto_symtab_encoder_encode_initializer_p (lto_symtab_encoder_t,
                                              varpool_node *);
 void output_symtab (void);
 void input_symtab (void);
+void output_offload_tables (void);
+void input_offload_tables (void);
 bool referenced_from_other_partition_p (struct ipa_ref_list *,
                                        lto_symtab_encoder_t);
 bool reachable_from_other_partition_p (struct cgraph_node *,
                                       lto_symtab_encoder_t);
-bool referenced_from_this_partition_p (struct ipa_ref_list *,
+bool referenced_from_this_partition_p (symtab_node *,
                                        lto_symtab_encoder_t);
 bool reachable_from_this_partition_p (struct cgraph_node *,
                                      lto_symtab_encoder_t);
 lto_symtab_encoder_t compute_ltrans_boundary (lto_symtab_encoder_t encoder);
+void select_what_to_stream (void);
+
+/* In options-save.c.  */
+void cl_target_option_stream_out (struct output_block *, struct bitpack_d *,
+                                 struct cl_target_option *);
+
+void cl_target_option_stream_in (struct data_in *,
+                                struct bitpack_d *,
+                                struct cl_target_option *);
+
+void cl_optimization_stream_out (struct bitpack_d *, struct cl_optimization *);
 
+void cl_optimization_stream_in (struct bitpack_d *, struct cl_optimization *);
 
-/* In lto-symtab.c.  */
-extern void lto_symtab_merge_decls (void);
-extern void lto_symtab_merge_symbols (void);
-extern tree lto_symtab_prevailing_decl (tree decl);
 
 
 /* In lto-opts.c.  */
@@ -999,7 +1034,7 @@ lto_tag_check_range (enum LTO_tags actual, enum LTO_tags tag1,
 static inline void
 lto_init_tree_ref_encoder (struct lto_tree_ref_encoder *encoder)
 {
-  encoder->tree_hash_table = new pointer_map<unsigned>;
+  encoder->tree_hash_table = new hash_map<tree, unsigned> (251);
   encoder->trees.create (0);
 }
 
@@ -1010,8 +1045,8 @@ static inline void
 lto_destroy_tree_ref_encoder (struct lto_tree_ref_encoder *encoder)
 {
   /* Hash table may be delete already.  */
-  if (encoder->tree_hash_table)
-    delete encoder->tree_hash_table;
+  delete encoder->tree_hash_table;
+  encoder->tree_hash_table = NULL;
   encoder->trees.release ();
 }
 
@@ -1047,8 +1082,8 @@ static inline int
 lto_symtab_encoder_lookup (lto_symtab_encoder_t encoder,
                           symtab_node *node)
 {
-  void **slot = pointer_map_contains (encoder->map, node);
-  return (slot && *slot ? (size_t) *(slot) - 1 : LCC_NOT_FOUND);
+  size_t *slot = encoder->map->get (node);
+  return (slot && *slot ? *(slot) - 1 : LCC_NOT_FOUND);
 }
 
 /* Return true if iterator LSE points to nothing.  */
@@ -1076,14 +1111,14 @@ lsei_node (lto_symtab_encoder_iterator lsei)
 static inline struct cgraph_node *
 lsei_cgraph_node (lto_symtab_encoder_iterator lsei)
 {
-  return cgraph (lsei.encoder->nodes[lsei.index].node);
+  return dyn_cast<cgraph_node *> (lsei.encoder->nodes[lsei.index].node);
 }
 
 /* Return the node pointed to by LSI.  */
 static inline varpool_node *
 lsei_varpool_node (lto_symtab_encoder_iterator lsei)
 {
-  return varpool (lsei.encoder->nodes[lsei.index].node);
+  return dyn_cast<varpool_node *> (lsei.encoder->nodes[lsei.index].node);
 }
 
 /* Return the cgraph node corresponding to REF using ENCODER.  */
@@ -1138,7 +1173,7 @@ lsei_next_function_in_partition (lto_symtab_encoder_iterator *lsei)
 {
   lsei_next (lsei);
   while (!lsei_end_p (*lsei)
-        && (!is_a <cgraph_node> (lsei_node (*lsei))
+        && (!is_a <cgraph_node *> (lsei_node (*lsei))
             || !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei))))
     lsei_next (lsei);
 }
@@ -1151,7 +1186,7 @@ lsei_start_function_in_partition (lto_symtab_encoder_t encoder)
 
   if (lsei_end_p (lsei))
     return lsei;
-  if (!is_a <cgraph_node> (lsei_node (lsei))
+  if (!is_a <cgraph_node *> (lsei_node (lsei))
       || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
     lsei_next_function_in_partition (&lsei);
 
@@ -1164,7 +1199,7 @@ lsei_next_variable_in_partition (lto_symtab_encoder_iterator *lsei)
 {
   lsei_next (lsei);
   while (!lsei_end_p (*lsei)
-        && (!is_a <varpool_node> (lsei_node (*lsei))
+        && (!is_a <varpool_node *> (lsei_node (*lsei))
             || !lto_symtab_encoder_in_partition_p (lsei->encoder, lsei_node (*lsei))))
     lsei_next (lsei);
 }
@@ -1177,7 +1212,7 @@ lsei_start_variable_in_partition (lto_symtab_encoder_t encoder)
 
   if (lsei_end_p (lsei))
     return lsei;
-  if (!is_a <varpool_node> (lsei_node (lsei))
+  if (!is_a <varpool_node *> (lsei_node (lsei))
       || !lto_symtab_encoder_in_partition_p (encoder, lsei_node (lsei)))
     lsei_next_variable_in_partition (&lsei);