]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/40081 (verify_stmts failed with -O2)
authorRichard Guenther <rguenther@suse.de>
Sun, 10 May 2009 16:40:55 +0000 (16:40 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sun, 10 May 2009 16:40:55 +0000 (16:40 +0000)
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

gcc/ChangeLog
gcc/tree-sra.c

index 23022ff0c613ffac17d5322d5a5e8a1575a81b5a..6c0177b65554c37545b1555cf4e41cab281b9647 100644 (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.
index 037052053197e855be015ec623ef4d8219a7d7fb..626a253d1525752005b3961dbde4119a899e7a25 100644 (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);