OSDN Git Service

2012-04-24 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Apr 2012 14:42:53 +0000 (14:42 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Apr 2012 14:42:53 +0000 (14:42 +0000)
PR tree-optimization/53085
* tree-ssa-pre.c (eliminate): Do not eliminate volatile redundant
stores.

* g++.dg/torture/pr53085.C: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@186765 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr53085.C [new file with mode: 0644]
gcc/tree-ssa-pre.c

index 0a4a8f9..b55fc7c 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-24  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/53085
+       * tree-ssa-pre.c (eliminate): Do not eliminate volatile redundant
+       stores.
+
 2012-04-24  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/53084
index 24b7f5a..bbbfc2f 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-24  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/53085
+       * g++.dg/torture/pr53085.C: New testcase.
+
 2012-04-23  Richard Guenther  <rguenther@suse.de>
 
        PR c/53060
diff --git a/gcc/testsuite/g++.dg/torture/pr53085.C b/gcc/testsuite/g++.dg/torture/pr53085.C
new file mode 100644 (file)
index 0000000..9ee29fe
--- /dev/null
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } { "" } }
+// { dg-options "-fdump-tree-optimized" }
+
+class aa{
+    void f();
+private:
+    volatile int a;
+};
+
+void aa::f(){
+    a=1;
+    a=1;
+}
+
+// { dg-final { scan-tree-dump-times "a ={v} 1;" 2 "optimized" } }
+// { dg-final { cleanup-tree-dump "optimized" } }
index e5ec931..b653ada 100644 (file)
@@ -4337,6 +4337,7 @@ eliminate (void)
             has the same value number as its rhs.  If so, the store is
             dead.  */
          else if (gimple_assign_single_p (stmt)
+                  && !gimple_has_volatile_ops (stmt)
                   && !is_gimple_reg (gimple_assign_lhs (stmt))
                   && (TREE_CODE (rhs) == SSA_NAME
                       || is_gimple_min_invariant (rhs)))