This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR55792
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: jh at suse dot de
- Date: Mon, 14 Jan 2013 16:51:02 +0100 (CET)
- Subject: [PATCH] Fix PR55792
This fixes LTO profiledbootstrap by pruning locations at
tree_function_versioning time - there seems to be at least one
uncatched case in IPA opts.
LTO profilebootstrapped and tested on x86_64-unknown-linux-gnu.
I also had the extended lto-cgraph.c verification in-tree but do not
plan to commit that.
Does this look reasonable or should somebody (not me ;)) try to track
down the place where we fail to unshare?
Thanks,
Richard.
2013-01-14 Richard Biener <rguenther@suse.de>
PR bootstrap/55792
* tree-inline.c (tree_function_versioning): Purge locations
from replaced parameters.
Index: gcc/lto-cgraph.c
===================================================================
*** gcc/lto-cgraph.c (revision 195144)
--- gcc/lto-cgraph.c (working copy)
*************** output_edge_opt_summary (struct output_b
*** 1492,1497 ****
--- 1492,1513 ----
{
}
+ static tree
+ verify_no_location_r (tree *tp, int *walk_subtrees, void *)
+ {
+ if (EXPR_P (*tp))
+ gcc_assert (EXPR_LOCATION (*tp) == UNKNOWN_LOCATION);
+ else
+ *walk_subtrees = 0;
+ return NULL_TREE;
+ }
+
+ static void
+ verify_no_location (tree expr)
+ {
+ walk_tree (&expr, verify_no_location_r, NULL, NULL);
+ }
+
/* Output optimization summary for NODE to OB. */
static void
*************** output_node_opt_summary (struct output_b
*** 1536,1542 ****
mechanism to store function local declarations into summaries. */
gcc_assert (parm);
streamer_write_uhwi (ob, parm_num);
! gcc_assert (EXPR_LOCATION (map->new_tree) == UNKNOWN_LOCATION);
stream_write_tree (ob, map->new_tree, true);
bp = bitpack_create (ob->main_stream);
bp_pack_value (&bp, map->replace_p, 1);
--- 1552,1560 ----
mechanism to store function local declarations into summaries. */
gcc_assert (parm);
streamer_write_uhwi (ob, parm_num);
! #ifdef ENABLE_CHECKING
! verify_no_location (map->new_tree);
! #endif
stream_write_tree (ob, map->new_tree, true);
bp = bitpack_create (ob->main_stream);
bp_pack_value (&bp, map->replace_p, 1);
Index: gcc/tree-inline.c
===================================================================
*** gcc/tree-inline.c (revision 195144)
--- gcc/tree-inline.c (working copy)
*************** tree_function_versioning (tree old_decl,
*** 5190,5196 ****
replace_info = (*tree_map)[i];
if (replace_info->replace_p)
{
! tree op = replace_info->new_tree;
if (!replace_info->old_tree)
{
int i = replace_info->parm_num;
--- 5190,5196 ----
replace_info = (*tree_map)[i];
if (replace_info->replace_p)
{
! tree op = unshare_expr_without_location (replace_info->new_tree);
if (!replace_info->old_tree)
{
int i = replace_info->parm_num;
*************** tree_function_versioning (tree old_decl,
*** 5199,5216 ****
i --;
replace_info->old_tree = parm;
}
-
-
- STRIP_NOPS (op);
-
- if (TREE_CODE (op) == VIEW_CONVERT_EXPR)
- op = TREE_OPERAND (op, 0);
-
gcc_assert (TREE_CODE (replace_info->old_tree) == PARM_DECL);
init = setup_one_parameter (&id, replace_info->old_tree,
! replace_info->new_tree, id.src_fn,
! NULL,
! &vars);
if (init)
init_stmts.safe_push (init);
}
--- 5199,5208 ----
i --;
replace_info->old_tree = parm;
}
gcc_assert (TREE_CODE (replace_info->old_tree) == PARM_DECL);
+
init = setup_one_parameter (&id, replace_info->old_tree,
! op, id.src_fn, NULL, &vars);
if (init)
init_stmts.safe_push (init);
}