re PR tree-optimization/40081 (verify_stmts failed with -O2)

2009-05-10  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/40081
	Revert
	* tree-sra.c (instantiate_element): Instantiate scalar replacements
	using the main variant of the element type.  Do not fiddle with
	TREE_THIS_VOLATILE or TREE_SIDE_EFFECTS.

	* tree-sra.c (sra_type_can_be_decomposed_p): Do not decompose
	structs with volatile fields.

From-SVN: r147349
This commit is contained in:
Richard Guenther 2009-05-10 16:40:55 +00:00 committed by Richard Biener
parent ade1f226fa
commit b7d7a473ab
2 changed files with 23 additions and 4 deletions

View File

@ -1,3 +1,14 @@
2009-05-10 Richard Guenther <rguenther@suse.de>
PR tree-optimization/40081
Revert
* tree-sra.c (instantiate_element): Instantiate scalar replacements
using the main variant of the element type. Do not fiddle with
TREE_THIS_VOLATILE or TREE_SIDE_EFFECTS.
* tree-sra.c (sra_type_can_be_decomposed_p): Do not decompose
structs with volatile fields.
2009-05-10 Jan Hubicka <jh@suse.cz>
* tree-inline.c (delete_unreachable_blocks_update_callgraph): Declare.

View File

@ -270,6 +270,10 @@ sra_type_can_be_decomposed_p (tree type)
!= TYPE_PRECISION (TREE_TYPE (t))))
goto fail;
/* And volatile fields. */
if (TREE_THIS_VOLATILE (t))
goto fail;
saw_one_field = true;
}
@ -1277,8 +1281,7 @@ instantiate_element (struct sra_elt *elt)
nowarn = TREE_NO_WARNING (base_elt->parent->element);
base = base_elt->element;
elt->replacement = var = make_rename_temp (TYPE_MAIN_VARIANT (elt->type),
"SR");
elt->replacement = var = make_rename_temp (elt->type, "SR");
if (DECL_P (elt->element)
&& !tree_int_cst_equal (DECL_SIZE (var), DECL_SIZE (elt->element)))
@ -1287,8 +1290,7 @@ instantiate_element (struct sra_elt *elt)
DECL_SIZE_UNIT (var) = DECL_SIZE_UNIT (elt->element);
elt->in_bitfld_block = 1;
elt->replacement = fold_build3 (BIT_FIELD_REF,
TYPE_MAIN_VARIANT (elt->type), var,
elt->replacement = fold_build3 (BIT_FIELD_REF, elt->type, var,
DECL_SIZE (var),
BYTES_BIG_ENDIAN
? size_binop (MINUS_EXPR,
@ -1305,6 +1307,12 @@ instantiate_element (struct sra_elt *elt)
DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (base);
DECL_ARTIFICIAL (var) = 1;
if (TREE_THIS_VOLATILE (elt->type))
{
TREE_THIS_VOLATILE (var) = 1;
TREE_SIDE_EFFECTS (var) = 1;
}
if (DECL_NAME (base) && !DECL_IGNORED_P (base))
{
char *pretty_name = build_element_name (elt);