Commit caee6ca1 by Martin Jambor Committed by Martin Jambor

re PR tree-optimization/42398 (internal compiler error: in sra_modify_expr, at tree-sra.c:2175)

2010-01-04  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/42398
	* tree-sra.c (struct access): Removed flag grp_different_types.
	(dump_access): Do not dump the removed flag.
	(sort_and_splice_var_accesses): Do not set the removed flag.
	(sra_modify_expr): Check for type compatibility directly.

	* testsuite/gcc.c-torture/compile/pr42398.c: New test.

From-SVN: r155631
parent 438789ff
2010-01-04 Martin Jambor <mjambor@suse.cz> 2010-01-04 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/42398
* tree-sra.c (struct access): Removed flag grp_different_types.
(dump_access): Do not dump the removed flag.
(sort_and_splice_var_accesses): Do not set the removed flag.
(sra_modify_expr): Check for type compatibility directly.
2010-01-04 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/42366 PR tree-optimization/42366
* ipa-cp.c (ipcp_init_stage): Always call ipa_compute_jump_functions on * ipa-cp.c (ipcp_init_stage): Always call ipa_compute_jump_functions on
edges with variable number of parameters. edges with variable number of parameters.
......
2010-01-04 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/42398
* gcc.c-torture/compile/pr42398.c: New test.
2010-01-04 Jason Merrill <jason@redhat.com> 2010-01-04 Jason Merrill <jason@redhat.com>
PR c++/42555 PR c++/42555
......
int ptrace_setregs(void)
{
union { unsigned int l; int t; } __gu_tmp;
__asm__ __volatile__("" : "=r" (__gu_tmp.l));
return __gu_tmp.t;
}
...@@ -199,10 +199,6 @@ struct access ...@@ -199,10 +199,6 @@ struct access
BIT_FIELD_REF? */ BIT_FIELD_REF? */
unsigned grp_partial_lhs : 1; unsigned grp_partial_lhs : 1;
/* Does this group contain accesses to different types? (I.e. through a union
or a similar mechanism). */
unsigned grp_different_types : 1;
/* Set when a scalar replacement should be created for this variable. We do /* Set when a scalar replacement should be created for this variable. We do
the decision and creation at different places because create_tmp_var the decision and creation at different places because create_tmp_var
cannot be called from within FOR_EACH_REFERENCED_VAR. */ cannot be called from within FOR_EACH_REFERENCED_VAR. */
...@@ -343,14 +339,12 @@ dump_access (FILE *f, struct access *access, bool grp) ...@@ -343,14 +339,12 @@ dump_access (FILE *f, struct access *access, bool grp)
fprintf (f, ", grp_write = %d, grp_read = %d, grp_hint = %d, " fprintf (f, ", grp_write = %d, grp_read = %d, grp_hint = %d, "
"grp_covered = %d, grp_unscalarizable_region = %d, " "grp_covered = %d, grp_unscalarizable_region = %d, "
"grp_unscalarized_data = %d, grp_partial_lhs = %d, " "grp_unscalarized_data = %d, grp_partial_lhs = %d, "
"grp_different_types = %d, grp_to_be_replaced = %d, " "grp_to_be_replaced = %d, grp_maybe_modified = %d, "
"grp_maybe_modified = %d, "
"grp_not_necessarilly_dereferenced = %d\n", "grp_not_necessarilly_dereferenced = %d\n",
access->grp_write, access->grp_read, access->grp_hint, access->grp_write, access->grp_read, access->grp_hint,
access->grp_covered, access->grp_unscalarizable_region, access->grp_covered, access->grp_unscalarizable_region,
access->grp_unscalarized_data, access->grp_partial_lhs, access->grp_unscalarized_data, access->grp_partial_lhs,
access->grp_different_types, access->grp_to_be_replaced, access->grp_to_be_replaced, access->grp_maybe_modified,
access->grp_maybe_modified,
access->grp_not_necessarilly_dereferenced); access->grp_not_necessarilly_dereferenced);
else else
fprintf (f, ", write = %d, grp_partial_lhs = %d\n", access->write, fprintf (f, ", write = %d, grp_partial_lhs = %d\n", access->write,
...@@ -1434,7 +1428,6 @@ sort_and_splice_var_accesses (tree var) ...@@ -1434,7 +1428,6 @@ sort_and_splice_var_accesses (tree var)
bool grp_read = !access->write; bool grp_read = !access->write;
bool multiple_reads = false; bool multiple_reads = false;
bool grp_partial_lhs = access->grp_partial_lhs; bool grp_partial_lhs = access->grp_partial_lhs;
bool grp_different_types = false;
bool first_scalar = is_gimple_reg_type (access->type); bool first_scalar = is_gimple_reg_type (access->type);
bool unscalarizable_region = access->grp_unscalarizable_region; bool unscalarizable_region = access->grp_unscalarizable_region;
...@@ -1466,7 +1459,6 @@ sort_and_splice_var_accesses (tree var) ...@@ -1466,7 +1459,6 @@ sort_and_splice_var_accesses (tree var)
grp_read = true; grp_read = true;
} }
grp_partial_lhs |= ac2->grp_partial_lhs; grp_partial_lhs |= ac2->grp_partial_lhs;
grp_different_types |= !types_compatible_p (access->type, ac2->type);
unscalarizable_region |= ac2->grp_unscalarizable_region; unscalarizable_region |= ac2->grp_unscalarizable_region;
relink_to_new_repr (access, ac2); relink_to_new_repr (access, ac2);
...@@ -1485,7 +1477,6 @@ sort_and_splice_var_accesses (tree var) ...@@ -1485,7 +1477,6 @@ sort_and_splice_var_accesses (tree var)
access->grp_read = grp_read; access->grp_read = grp_read;
access->grp_hint = multiple_reads; access->grp_hint = multiple_reads;
access->grp_partial_lhs = grp_partial_lhs; access->grp_partial_lhs = grp_partial_lhs;
access->grp_different_types = grp_different_types;
access->grp_unscalarizable_region = unscalarizable_region; access->grp_unscalarizable_region = unscalarizable_region;
if (access->first_link) if (access->first_link)
add_access_to_work_queue (access); add_access_to_work_queue (access);
...@@ -2141,11 +2132,9 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write, ...@@ -2141,11 +2132,9 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write,
We also want to use this when accessing a complex or vector which can We also want to use this when accessing a complex or vector which can
be accessed as a different type too, potentially creating a need for be accessed as a different type too, potentially creating a need for
type conversion (see PR42196). */ type conversion (see PR42196) and when scalarized unions are involved
if (!is_gimple_reg_type (type) in assembler statements (see PR42398). */
|| (access->grp_different_types if (!useless_type_conversion_p (type, access->type))
&& (TREE_CODE (type) == COMPLEX_TYPE
|| TREE_CODE (type) == VECTOR_TYPE)))
{ {
tree ref = access->base; tree ref = access->base;
bool ok; bool ok;
...@@ -2176,10 +2165,7 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write, ...@@ -2176,10 +2165,7 @@ sra_modify_expr (tree *expr, gimple_stmt_iterator *gsi, bool write,
} }
} }
else else
{
gcc_assert (useless_type_conversion_p (type, access->type));
*expr = repl; *expr = repl;
}
sra_stats.exprs++; sra_stats.exprs++;
} }
......
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