Commit d1f98542 by Richard Biener Committed by Richard Biener

re PR lto/55736 (lto ICE: tree code ''junl is not supported in LTO streams)

2012-12-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/55736
	PR tree-optimization/55703
	* gimplify.c (prune_expr_location): New function.
	(unshare_expr_without_location): Likewise.
	* tree.h (unshare_expr_without_location): Declare.
	* ipa-prop.c (prune_expression_for_jf): Remove.
	(prune_expression_for_jf_1): Likewise.
	(ipa_set_jf_constant): Use unshare_expr_without_location.
	(ipa_set_jf_arith_pass_through): Likewise.
	(determine_known_aggregate_parts): Likewise.
	* tree-switch-conversion.c (build_constructors): Use
	unshare_expr_without_location on all constructor elements.

	* gcc.dg/lto/pr55703_0.c: New testcase.

From-SVN: r194609
parent c354951b
2012-12-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/55736
PR tree-optimization/55703
* gimplify.c (prune_expr_location): New function.
(unshare_expr_without_location): Likewise.
* tree.h (unshare_expr_without_location): Declare.
* ipa-prop.c (prune_expression_for_jf): Remove.
(prune_expression_for_jf_1): Likewise.
(ipa_set_jf_constant): Use unshare_expr_without_location.
(ipa_set_jf_arith_pass_through): Likewise.
(determine_known_aggregate_parts): Likewise.
* tree-switch-conversion.c (build_constructors): Use
unshare_expr_without_location on all constructor elements.
2012-12-19 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* target.def: Define canonicalize_comparison hook.
......@@ -1059,6 +1059,30 @@ unshare_expr (tree expr)
walk_tree (&expr, mostly_copy_tree_r, NULL, NULL);
return expr;
}
/* Worker for unshare_expr_without_location. */
static tree
prune_expr_location (tree *tp, int *walk_subtrees, void *)
{
if (EXPR_P (*tp))
SET_EXPR_LOCATION (*tp, UNKNOWN_LOCATION);
else
*walk_subtrees = 0;
return NULL_TREE;
}
/* Similar to unshare_expr but also prune all expression locations
from EXPR. */
tree
unshare_expr_without_location (tree expr)
{
walk_tree (&expr, mostly_copy_tree_r, NULL, NULL);
if (EXPR_P (expr))
walk_tree (&expr, prune_expr_location, NULL, NULL);
return expr;
}
/* WRAPPER is a code such as BIND_EXPR or CLEANUP_POINT_EXPR which can both
contain statements and have a value. Assign its value to a temporary
......
......@@ -295,31 +295,6 @@ ipa_print_all_jump_functions (FILE *f)
}
}
/* Worker for prune_expression_for_jf. */
static tree
prune_expression_for_jf_1 (tree *tp, int *walk_subtrees, void *)
{
if (EXPR_P (*tp))
SET_EXPR_LOCATION (*tp, UNKNOWN_LOCATION);
else
*walk_subtrees = 0;
return NULL_TREE;
}
/* Return the expression tree EXPR unshared and with location stripped off. */
static tree
prune_expression_for_jf (tree exp)
{
if (EXPR_P (exp))
{
exp = unshare_expr (exp);
walk_tree (&exp, prune_expression_for_jf_1, NULL, NULL);
}
return exp;
}
/* Set JFUNC to be a known type jump function. */
static void
......@@ -341,7 +316,7 @@ ipa_set_jf_constant (struct ipa_jump_func *jfunc, tree constant)
if (constant && EXPR_P (constant))
SET_EXPR_LOCATION (constant, UNKNOWN_LOCATION);
jfunc->type = IPA_JF_CONST;
jfunc->value.constant = prune_expression_for_jf (constant);
jfunc->value.constant = unshare_expr_without_location (constant);
}
/* Set JFUNC to be a simple pass-through jump function. */
......@@ -363,7 +338,7 @@ ipa_set_jf_arith_pass_through (struct ipa_jump_func *jfunc, int formal_id,
tree operand, enum tree_code operation)
{
jfunc->type = IPA_JF_PASS_THROUGH;
jfunc->value.pass_through.operand = prune_expression_for_jf (operand);
jfunc->value.pass_through.operand = unshare_expr_without_location (operand);
jfunc->value.pass_through.formal_id = formal_id;
jfunc->value.pass_through.operation = operation;
jfunc->value.pass_through.agg_preserved = false;
......@@ -1385,7 +1360,7 @@ determine_known_aggregate_parts (gimple call, tree arg,
{
struct ipa_agg_jf_item item;
item.offset = list->offset - arg_offset;
item.value = prune_expression_for_jf (list->constant);
item.value = unshare_expr_without_location (list->constant);
jfunc->agg.items->quick_push (item);
}
list = list->next;
......
2012-12-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/55736
PR tree-optimization/55703
* gcc.dg/lto/pr55703_0.c: New testcase.
2012-12-19 Jakub Jelinek <jakub@redhat.com>
PR debug/55730
......
/* { dg-lto-do run } */
/* { dg-lto-options { { -O2 -flto -fno-tree-copy-prop -fno-tree-dce } } } */
int try (int num) {
__label__ lab1, lab2, lab3, lab4, lab5, lab6, default_lab;
void *do_switch (int num) {
switch(num) {
case 1:
return &&lab1;
case 2:
return &&lab2;
case 3:
return &&lab3;
case 4:
return &&lab4;
case 5:
return &&lab5;
case 6:
return &&lab6;
default:
return &&default_lab;
}
}
goto *do_switch (num);
lab1:
return 1;
lab2:
return 2;
lab3:
return 3;
lab4:
return 4;
lab5:
return 5;
lab6:
return 6;
default_lab:
return -1;
}
main()
{
int i;
for (i = 1; i <= 6; i++)
{
if (try (i) != i)
__builtin_abort();
}
__builtin_exit(0);
}
......@@ -873,7 +873,8 @@ build_constructors (gimple swtch, struct switch_conv_info *info)
constructor_elt elt;
elt.index = int_const_binop (MINUS_EXPR, pos, info->range_min);
elt.value = info->default_values[k];
elt.value
= unshare_expr_without_location (info->default_values[k]);
info->constructors[k]->quick_push (elt);
}
......@@ -899,7 +900,7 @@ build_constructors (gimple swtch, struct switch_conv_info *info)
constructor_elt elt;
elt.index = int_const_binop (MINUS_EXPR, pos, info->range_min);
elt.value = val;
elt.value = unshare_expr_without_location (val);
info->constructors[j]->quick_push (elt);
pos = int_const_binop (PLUS_EXPR, pos, integer_one_node);
......
......@@ -5606,6 +5606,7 @@ extern void change_decl_assembler_name (tree, tree);
/* In gimplify.c */
extern tree unshare_expr (tree);
extern tree unshare_expr_without_location (tree);
/* In stmt.c */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment