From: Richard Biener Date: Fri, 14 Feb 2014 12:03:43 +0000 (+0000) Subject: re PR target/60179 (target optimization attribute streaming is broken) X-Git-Tag: upstream/12.2.0~64732 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1966fd99d822c06cbfb667806ba8bcf1fecaef58;p=platform%2Fupstream%2Fgcc.git re PR target/60179 (target optimization attribute streaming is broken) 2014-02-14 Richard Biener 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 99d55bf..2a2e5d2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2014-02-14 Richard Biener + + 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 * tree-vect-loop.c (vect_is_slp_reduction): Don't set diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 94d2aa7..0f37f1c 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -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)); } diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 1b55d3e..9b0c61a 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,10 @@ +2014-02-14 Richard Biener + + 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 PR lto/60060 diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 6f2428d..c676d79 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -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) diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c index 8227a01..b02bb6b 100644 --- a/gcc/tree-streamer-in.c +++ b/gcc/tree-streamer-in.c @@ -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, diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c index a4d943b..646fba5 100644 --- a/gcc/tree-streamer-out.c +++ b/gcc/tree-streamer-out.c @@ -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); }