mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
re PR tree-optimization/32721 (CCP removes volatile qualifiers.)
2007-07-13 Richard Guenther <rguenther@suse.de> PR tree-optimization/32721 * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Preserve TREE_THIS_VOLATILE on the folded reference. * tree-ssa-operands.c (get_expr_operands): Set has_volatile_ops if the array reference has TREE_THIS_VOLATILE set. * gcc.dg/pr32721.c: New testcase. From-SVN: r126624
This commit is contained in:
parent
05724daed2
commit
cbf8d355b8
@ -1,3 +1,11 @@
|
||||
2007-07-13 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/32721
|
||||
* tree-ssa-ccp.c (maybe_fold_stmt_indirect): Preserve
|
||||
TREE_THIS_VOLATILE on the folded reference.
|
||||
* tree-ssa-operands.c (get_expr_operands): Set has_volatile_ops
|
||||
if the array reference has TREE_THIS_VOLATILE set.
|
||||
|
||||
2007-07-13 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR other/32188
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-07-13 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/32721
|
||||
* gcc.dg/pr32721.c: New testcase.
|
||||
|
||||
2007-07-13 Hans-Peter Nilsson <hp@axis.com>
|
||||
|
||||
* gcc.dg/20011127-1.c: Use dg-message, not dg-error to match the
|
||||
|
18
gcc/testsuite/gcc.dg/pr32721.c
Normal file
18
gcc/testsuite/gcc.dg/pr32721.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-optimized" } */
|
||||
|
||||
int spinlock[2];
|
||||
int main ()
|
||||
{
|
||||
volatile int * spinlock0;
|
||||
volatile int * spinlock1;
|
||||
spinlock0 = &spinlock[0];
|
||||
spinlock1 = &spinlock[1];
|
||||
|
||||
*spinlock0 = 0;
|
||||
*spinlock1 = 0;
|
||||
while (*spinlock0);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump "= spinlock.0." "optimized" } } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
@ -1839,6 +1839,7 @@ static tree
|
||||
maybe_fold_stmt_indirect (tree expr, tree base, tree offset)
|
||||
{
|
||||
tree t;
|
||||
bool volatile_p = TREE_THIS_VOLATILE (expr);
|
||||
|
||||
/* We may well have constructed a double-nested PLUS_EXPR via multiple
|
||||
substitutions. Fold that down to one. Remove NON_LVALUE_EXPRs that
|
||||
@ -1882,7 +1883,10 @@ maybe_fold_stmt_indirect (tree expr, tree base, tree offset)
|
||||
t = maybe_fold_offset_to_reference (base_addr, offset,
|
||||
TREE_TYPE (expr));
|
||||
if (t)
|
||||
return t;
|
||||
{
|
||||
TREE_THIS_VOLATILE (t) = volatile_p;
|
||||
return t;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2078,6 +2078,9 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
|
||||
|
||||
if (!none)
|
||||
flags |= opf_no_vops;
|
||||
|
||||
if (TREE_THIS_VOLATILE (expr))
|
||||
get_stmt_ann (stmt)->has_volatile_ops = true;
|
||||
}
|
||||
else if (TREE_CODE (ref) == INDIRECT_REF)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user