aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-05-10 16:40:55 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-05-10 16:40:55 +0000
commitb7d7a473ab0813c0f52f71248f3c204dfb2451f0 (patch)
tree46ffe657f00f9daedaa94686a0e36e6ce6b56021 /gcc
parentade1f226fa9fe1cf12523ec439b1a53b7f0b5910 (diff)
downloadgcc-b7d7a473ab0813c0f52f71248f3c204dfb2451f0.zip
gcc-b7d7a473ab0813c0f52f71248f3c204dfb2451f0.tar.gz
gcc-b7d7a473ab0813c0f52f71248f3c204dfb2451f0.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/tree-sra.c16
2 files changed, 23 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 23022ff..6c0177b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 0370520..626a253 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -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);