aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-11-28 21:03:11 +0000
committerJakub Jelinek <jakub@redhat.com>2011-11-28 21:03:11 +0000
commitdc6ff64de18db9c63be1dd57036b6d7b372e55d6 (patch)
tree32e3db64b2d2968a496e87e98982ff6eb23b7915 /gcc/tree-ssa-forwprop.c
parent83d114ff3900571e37143c7a40baa59e55ba1d2e (diff)
PR tree-optimization/50078
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Copy over TREE_THIS_VOLATILE also from the old to new lhs resp. rhs. * gcc.dg/pr50078.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@181786 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index d707db520e3..6ab47317770 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -910,7 +910,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
TREE_TYPE (gimple_assign_rhs1 (use_stmt))))
{
tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0);
- tree new_offset, new_base, saved;
+ tree new_offset, new_base, saved, new_lhs;
while (handled_component_p (*def_rhs_basep))
def_rhs_basep = &TREE_OPERAND (*def_rhs_basep, 0);
saved = *def_rhs_basep;
@@ -930,8 +930,9 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
new_base, new_offset);
TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (lhs);
TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (lhs);
- gimple_assign_set_lhs (use_stmt,
- unshare_expr (TREE_OPERAND (def_rhs, 0)));
+ new_lhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
+ gimple_assign_set_lhs (use_stmt, new_lhs);
+ TREE_THIS_VOLATILE (new_lhs) = TREE_THIS_VOLATILE (lhs);
*def_rhs_basep = saved;
tidy_after_forward_propagate_addr (use_stmt);
/* Continue propagating into the RHS if this was not the
@@ -991,7 +992,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
TREE_TYPE (TREE_OPERAND (def_rhs, 0))))
{
tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0);
- tree new_offset, new_base, saved;
+ tree new_offset, new_base, saved, new_rhs;
while (handled_component_p (*def_rhs_basep))
def_rhs_basep = &TREE_OPERAND (*def_rhs_basep, 0);
saved = *def_rhs_basep;
@@ -1011,8 +1012,9 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
new_base, new_offset);
TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (rhs);
TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (rhs);
- gimple_assign_set_rhs1 (use_stmt,
- unshare_expr (TREE_OPERAND (def_rhs, 0)));
+ new_rhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
+ gimple_assign_set_rhs1 (use_stmt, new_rhs);
+ TREE_THIS_VOLATILE (new_rhs) = TREE_THIS_VOLATILE (rhs);
*def_rhs_basep = saved;
fold_stmt_inplace (use_stmt_gsi);
tidy_after_forward_propagate_addr (use_stmt);