re PR tree-optimization/53085 (writes to volatile struct members is missing)

2012-04-24  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/53085
	* tree-ssa-pre.c (eliminate): Do not eliminate volatile redundant
	stores.

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

From-SVN: r186764
This commit is contained in:
Richard Guenther 2012-04-24 14:41:49 +00:00 committed by Richard Biener
parent 05232ff6d3
commit 46b380a23b
4 changed files with 29 additions and 0 deletions

View 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 Richard Guenther <rguenther@suse.de>
* tree-if-conv.c (main_tree_if_conversion): Move bb under

View 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-24 Andrew Pinski <apinski@cavium.com>
PR tree-opt/33512

View File

@ -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" } }

View File

@ -4409,6 +4409,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)))