]> gcc.gnu.org Git - gcc.git/commitdiff
re PR target/60179 (target optimization attribute streaming is broken)
authorRichard Biener <rguenther@suse.de>
Fri, 14 Feb 2014 12:03:43 +0000 (12:03 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 14 Feb 2014 12:03:43 +0000 (12:03 +0000)
2014-02-14  Richard Biener  <rguenther@suse.de>

PR lto/60179
* lto-streamer-out.c (DFS_write_tree_body): Do not follow
DECL_FUNCTION_SPECIFIC_TARGET.
(hash_tree): Do not hash DECL_FUNCTION_SPECIFIC_TARGET.
* tree-streamer-out.c (pack_ts_target_option): Remove.
(streamer_pack_tree_bitfields): Do not stream
TS_TARGET_OPTION.
(write_ts_function_decl_tree_pointers): Do not stream
DECL_FUNCTION_SPECIFIC_TARGET.
* tree-streamer-in.c (unpack_ts_target_option): Remove.
(unpack_value_fields): Do not stream TS_TARGET_OPTION.
(lto_input_ts_function_decl_tree_pointers): Do not stream
DECL_FUNCTION_SPECIFIC_TARGET.

lto/
* lto.c (compare_tree_sccs_1): Do not compare
DECL_FUNCTION_SPECIFIC_TARGET.
(lto_read_decls): Re-build DECL_FUNCTION_SPECIFIC_TARGET.

From-SVN: r207783

gcc/ChangeLog
gcc/lto-streamer-out.c
gcc/lto/ChangeLog
gcc/lto/lto.c
gcc/tree-streamer-in.c
gcc/tree-streamer-out.c

index 99d55bfd84a4f0c2e090ec730c1afba1a6a777dc..2a2e5d2d5dc64bd4dcad51b5aeb895b580c6b699 100644 (file)
@@ -1,3 +1,19 @@
+2014-02-14  Richard Biener  <rguenther@suse.de>
+
+       PR lto/60179
+       * lto-streamer-out.c (DFS_write_tree_body): Do not follow
+       DECL_FUNCTION_SPECIFIC_TARGET.
+       (hash_tree): Do not hash DECL_FUNCTION_SPECIFIC_TARGET.
+       * tree-streamer-out.c (pack_ts_target_option): Remove.
+       (streamer_pack_tree_bitfields): Do not stream
+       TS_TARGET_OPTION.
+       (write_ts_function_decl_tree_pointers): Do not stream
+       DECL_FUNCTION_SPECIFIC_TARGET.
+       * tree-streamer-in.c (unpack_ts_target_option): Remove.
+       (unpack_value_fields): Do not stream TS_TARGET_OPTION.
+       (lto_input_ts_function_decl_tree_pointers): Do not stream
+       DECL_FUNCTION_SPECIFIC_TARGET.
+
 2014-02-14  Jakub Jelinek  <jakub@redhat.com>
 
        * tree-vect-loop.c (vect_is_slp_reduction): Don't set
index 94d2aa73dddd391fd99f84a8ecbfcc7ac322af9a..0f37f1c24228149b3a04d10163c925e6fc814e84 100644 (file)
@@ -550,7 +550,7 @@ DFS_write_tree_body (struct output_block *ob,
   if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
     {
       DFS_follow_tree_edge (DECL_FUNCTION_PERSONALITY (expr));
-      DFS_follow_tree_edge (DECL_FUNCTION_SPECIFIC_TARGET (expr));
+      /* Do not DECL_FUNCTION_SPECIFIC_TARGET.  They will be regenerated.  */
       DFS_follow_tree_edge (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr));
     }
 
@@ -885,7 +885,7 @@ hash_tree (struct streamer_tree_cache_d *cache, tree t)
                        strlen (TRANSLATION_UNIT_LANGUAGE (t)), v);
 
   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
-    v = iterative_hash (t, sizeof (struct cl_target_option), v);
+    gcc_unreachable ();
 
   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
     v = iterative_hash (t, sizeof (struct cl_optimization), v);
@@ -986,7 +986,7 @@ hash_tree (struct streamer_tree_cache_d *cache, tree t)
   if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
     {
       visit (DECL_FUNCTION_PERSONALITY (t));
-      visit (DECL_FUNCTION_SPECIFIC_TARGET (t));
+      /* Do not follow DECL_FUNCTION_SPECIFIC_TARGET.  */
       visit (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (t));
     }
 
index 1b55d3efd73e57c3bef8e082d802e9cc57ebabb4..9b0c61a9c44ed51acbced4997ce77618d4373fc5 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-14  Richard Biener  <rguenther@suse.de>
+
+       PR lto/60179
+       * lto.c (compare_tree_sccs_1): Do not compare
+       DECL_FUNCTION_SPECIFIC_TARGET.
+       (lto_read_decls): Re-build DECL_FUNCTION_SPECIFIC_TARGET.
+
 2014-02-12  Richard Biener  <rguenther@suse.de>
 
        PR lto/60060
index 6f2428db53861ced36ec513988127a9f0362aeae..c676d7912663e21b2eff53c323c27244f60b58b1 100644 (file)
@@ -1367,9 +1367,7 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
       return false;
 
   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
-    if (memcmp (TREE_TARGET_OPTION (t1), TREE_TARGET_OPTION (t2),
-               sizeof (struct cl_target_option)) != 0)
-      return false;
+    gcc_unreachable ();
 
   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
     if (memcmp (TREE_OPTIMIZATION (t1), TREE_OPTIMIZATION (t2),
@@ -1547,8 +1545,8 @@ compare_tree_sccs_1 (tree t1, tree t2, tree **map)
     {
       compare_tree_edges (DECL_FUNCTION_PERSONALITY (t1),
                          DECL_FUNCTION_PERSONALITY (t2));
-      compare_tree_edges (DECL_FUNCTION_SPECIFIC_TARGET (t1),
-                         DECL_FUNCTION_SPECIFIC_TARGET (t2));
+      /* DECL_FUNCTION_SPECIFIC_TARGET is not yet created.  We compare
+         the attribute list instead.  */
       compare_tree_edges (DECL_FUNCTION_SPECIFIC_OPTIMIZATION (t1),
                          DECL_FUNCTION_SPECIFIC_OPTIMIZATION (t2));
     }
@@ -1926,6 +1924,15 @@ lto_read_decls (struct lto_file_decl_data *decl_data, const void *data,
              if (TREE_CODE (t) == INTEGER_CST
                  && !TREE_OVERFLOW (t))
                cache_integer_cst (t);
+             /* Re-build DECL_FUNCTION_SPECIFIC_TARGET, we need that
+                for both WPA and LTRANS stage.  */
+             if (TREE_CODE (t) == FUNCTION_DECL)
+               {
+                 tree attr = lookup_attribute ("target", DECL_ATTRIBUTES (t));
+                 if (attr)
+                   targetm.target_option.valid_attribute_p
+                       (t, NULL_TREE, TREE_VALUE (attr), 0);
+               }
              /* Register TYPE_DECLs with the debuginfo machinery.  */
              if (!flag_wpa
                  && TREE_CODE (t) == TYPE_DECL)
index 8227a01eea69748876ecb1b72377fbea5b35575c..b02bb6bd0a0d0da2c7bfa632db94ed5e994ab04e 100644 (file)
@@ -394,21 +394,6 @@ unpack_ts_translation_unit_decl_value_fields (struct data_in *data_in,
   vec_safe_push (all_translation_units, expr);
 }
 
-/* Unpack a TS_TARGET_OPTION tree from BP into EXPR.  */
-
-static void
-unpack_ts_target_option (struct bitpack_d *bp, tree expr)
-{
-  unsigned i, len;
-  struct cl_target_option *t = TREE_TARGET_OPTION (expr);
-
-  len = sizeof (struct cl_target_option);
-  for (i = 0; i < len; i++)
-    ((unsigned char *)t)[i] = bp_unpack_value (bp, 8);
-  if (bp_unpack_value (bp, 32) != 0x12345678)
-    fatal_error ("cl_target_option size mismatch in LTO reader and writer");
-}
-
 /* Unpack a TS_OPTIMIZATION tree from BP into EXPR.  */
 
 static void
@@ -517,7 +502,7 @@ unpack_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr)
     unpack_ts_translation_unit_decl_value_fields (data_in, bp, expr);
 
   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
-    unpack_ts_target_option (bp, expr);
+    gcc_unreachable ();
 
   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
     unpack_ts_optimization (bp, expr);
@@ -796,7 +781,7 @@ lto_input_ts_function_decl_tree_pointers (struct lto_input_block *ib,
   /* DECL_STRUCT_FUNCTION is handled by lto_input_function.  FIXME lto,
      maybe it should be handled here?  */
   DECL_FUNCTION_PERSONALITY (expr) = stream_read_tree (ib, data_in);
-  DECL_FUNCTION_SPECIFIC_TARGET (expr) = stream_read_tree (ib, data_in);
+  /* DECL_FUNCTION_SPECIFIC_TARGET is regenerated from attributes.  */
   DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr) = stream_read_tree (ib, data_in);
 
   /* If the file contains a function with an EH personality set,
index a4d943bd3f4747e45e7a07272ee1406699c8ab55..646fba52688f7055cbbd8c274f8530f152b2b05e 100644 (file)
@@ -353,24 +353,6 @@ pack_ts_translation_unit_decl_value_fields (struct output_block *ob,
   bp_pack_string (ob, bp, TRANSLATION_UNIT_LANGUAGE (expr), true);
 }
 
-/* Pack a TS_TARGET_OPTION tree in EXPR to BP.  */
-
-static void
-pack_ts_target_option (struct bitpack_d *bp, tree expr)
-{
-  struct cl_target_option *t = TREE_TARGET_OPTION (expr);
-  unsigned i, len;
-
-  /* The cl_target_option is target specific and generated by the options
-     awk script, so we just recreate a byte-by-byte copy here. */
-
-  len = sizeof (struct cl_target_option);
-  for (i = 0; i < len; i++)
-    bp_pack_value (bp, ((unsigned char *)t)[i], 8);
-  /* Catch struct size mismatches between reader and writer. */
-  bp_pack_value (bp, 0x12345678, 32);
-}
-
 /* Pack a TS_OPTIMIZATION tree in EXPR to BP.  */
 
 static void
@@ -481,7 +463,7 @@ streamer_pack_tree_bitfields (struct output_block *ob,
     pack_ts_translation_unit_decl_value_fields (ob, bp, expr);
 
   if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
-    pack_ts_target_option (bp, expr);
+    gcc_unreachable ();
 
   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
     pack_ts_optimization (bp, expr);
@@ -716,7 +698,7 @@ write_ts_function_decl_tree_pointers (struct output_block *ob, tree expr,
   /* DECL_STRUCT_FUNCTION is handled by lto_output_function.  FIXME lto,
      maybe it should be handled here?  */
   stream_write_tree (ob, DECL_FUNCTION_PERSONALITY (expr), ref_p);
-  stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_TARGET (expr), ref_p);
+  /* DECL_FUNCTION_SPECIFIC_TARGET is regenerated.  */
   stream_write_tree (ob, DECL_FUNCTION_SPECIFIC_OPTIMIZATION (expr), ref_p);
 }
 
This page took 0.085118 seconds and 5 git commands to generate.