cgraph.c (cgraph_get_body): Update call of lto_input_function_body.
authorJan Hubicka <jh@suse.cz>
Sat, 31 Aug 2013 13:47:20 +0000 (15:47 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sat, 31 Aug 2013 13:47:20 +0000 (13:47 +0000)
* cgraph.c (cgraph_get_body): Update call of lto_input_function_body.
* gimple-streamer-in.c (input_gimple_stmt): Move sanity check to ...
* tree-cfg.c (verify_gimple_label): ... here.
* ipa-utils.c: Include lto-streamer.h, ipa-inline.h
(ipa_merge_profiles): New function.
* lto-streamer-in.c (lto_read_body): Take node instead of fn_decl.
(lto_input_function_body): Likewise.
* ipa-utils.h (ipa_merge_profiles): Declare.
* lto-streamer.h (lto_input_function_body): Update prototype.
(emit_label_in_global_context_p): Remove.
* lto-symtab.c: Include ipa-utils.h
(lto_cgraph_replace_node): Use ipa_merge_profiles.

From-SVN: r202131

gcc/ChangeLog
gcc/ipa-utils.h
gcc/lto-streamer.h
gcc/lto-symtab.c
gcc/tree-cfg.c

index a5824be71ad6a06337112d54349aecc346f02e84..f569cdab7493e3a979788a19b2cbb83345ddd5da 100644 (file)
@@ -2,10 +2,16 @@
 
        * cgraph.c (cgraph_get_body): Update call of lto_input_function_body.
        * gimple-streamer-in.c (input_gimple_stmt): Move sanity check to ...
+       * tree-cfg.c (verify_gimple_label): ... here.
        * ipa-utils.c: Include lto-streamer.h, ipa-inline.h
        (ipa_merge_profiles): New function.
        * lto-streamer-in.c (lto_read_body): Take node instead of fn_decl.
        (lto_input_function_body): Likewise.
+       * ipa-utils.h (ipa_merge_profiles): Declare.
+       * lto-streamer.h (lto_input_function_body): Update prototype.
+       (emit_label_in_global_context_p): Remove.
+       * lto-symtab.c: Include ipa-utils.h
+       (lto_cgraph_replace_node): Use ipa_merge_profiles.
 
 2013-08-31  Jan Hubicka  <jh@suse.cz>
 
index 427245509b03f69baed017d9d83fb784e03d424e..77ed6cee63af35957bfe4c1c350b61bd6e6ece75 100644 (file)
@@ -44,6 +44,8 @@ void ipa_free_postorder_info (void);
 vec<cgraph_node_ptr> ipa_get_nodes_in_cycle (struct cgraph_node *);
 int ipa_reverse_postorder (struct cgraph_node **);
 tree get_base_var (tree);
+void ipa_merge_profiles (struct cgraph_node *dst,
+                        struct cgraph_node *src);
 
 /* In ipa-devirt.c  */
 
index 663ab24aa05a46a3825284cd297aeb7fef4fae05..4a2ea0b2993d659d0840b4e414fba1eb927173d1 100644 (file)
@@ -834,7 +834,8 @@ extern void lto_streamer_hooks_init (void);
 /* In lto-streamer-in.c */
 extern void lto_input_cgraph (struct lto_file_decl_data *, const char *);
 extern void lto_reader_init (void);
-extern void lto_input_function_body (struct lto_file_decl_data *, tree,
+extern void lto_input_function_body (struct lto_file_decl_data *,
+                                    struct cgraph_node *,
                                     const char *);
 extern void lto_input_constructors_and_inits (struct lto_file_decl_data *,
                                              const char *);
@@ -1030,14 +1031,6 @@ lto_tree_ref_encoder_get_tree (struct lto_tree_ref_encoder *encoder,
   return encoder->trees[idx];
 }
 
-
-/* Return true if LABEL should be emitted in the global context.  */
-static inline bool
-emit_label_in_global_context_p (tree label)
-{
-  return DECL_NONLOCAL (label) || FORCED_LABEL (label);
-}
-
 /* Return number of encoded nodes in ENCODER.  */
 static inline int
 lto_symtab_encoder_size (lto_symtab_encoder_t encoder)
index 7c2add7232aad9765b0ef4450e30af16665d6b56..83026ef7c8c0b530d3d0a4bc641c61bc11affd69 100644 (file)
@@ -28,6 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "hashtab.h"
 #include "plugin-api.h"
 #include "lto-streamer.h"
+#include "ipa-utils.h"
 
 /* Vector to keep track of external variables we've seen so far.  */
 vec<tree, va_gc> *lto_global_var_decls;
@@ -80,6 +81,7 @@ lto_cgraph_replace_node (struct cgraph_node *node,
   /* Redirect incomming references.  */
   ipa_clone_referring ((symtab_node)prevailing_node, &node->symbol.ref_list);
 
+  ipa_merge_profiles (prevailing_node, node);
   lto_free_function_in_decl_state_for_node ((symtab_node)node);
 
   if (node->symbol.decl != prevailing_node->symbol.decl)
index af8685c7a753f0573a68bce4ea98d92be60eed04..bc1e1ba90fcca0db090b93cef6a82133ab6ee25e 100644 (file)
@@ -4252,6 +4252,12 @@ verify_gimple_label (gimple stmt)
 
   if (TREE_CODE (decl) != LABEL_DECL)
     return true;
+  if (!DECL_NONLOCAL (decl) && !FORCED_LABEL (decl)
+      && DECL_CONTEXT (decl) != current_function_decl)
+    {
+      error ("label's context is not the current function decl");
+      err |= true;
+    }
 
   uid = LABEL_DECL_UID (decl);
   if (cfun->cfg