aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-12-08 20:49:02 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2011-12-08 20:49:02 +0100
commit4be257dcc48c64761d15bced7b292abe9ef1ffee (patch)
tree6caf2e8d00f1a83d05f8fcda61769a913fceedc0 /gcc/tree-ssa-forwprop.c
parent32157107405ff1912d3d5382b0195e579e527bae (diff)
downloadgcc-4be257dcc48c64761d15bced7b292abe9ef1ffee.zip
gcc-4be257dcc48c64761d15bced7b292abe9ef1ffee.tar.gz
gcc-4be257dcc48c64761d15bced7b292abe9ef1ffee.tar.bz2
re PR tree-optimization/51466 (ICE in gimple_rhs_has_side_effects,)
PR tree-optimization/51466 * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Also copy TREE_SIDE_EFFECTS. * gcc.c-torture/execute/pr51466.c: New test. From-SVN: r182136
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 6ab4731..20821ef 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -929,10 +929,12 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
*def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep),
new_base, new_offset);
TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (lhs);
+ TREE_SIDE_EFFECTS (*def_rhs_basep) = TREE_SIDE_EFFECTS (lhs);
TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (lhs);
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);
+ TREE_SIDE_EFFECTS (new_lhs) = TREE_SIDE_EFFECTS (lhs);
*def_rhs_basep = saved;
tidy_after_forward_propagate_addr (use_stmt);
/* Continue propagating into the RHS if this was not the
@@ -1011,10 +1013,12 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs,
*def_rhs_basep = build2 (MEM_REF, TREE_TYPE (*def_rhs_basep),
new_base, new_offset);
TREE_THIS_VOLATILE (*def_rhs_basep) = TREE_THIS_VOLATILE (rhs);
+ TREE_SIDE_EFFECTS (*def_rhs_basep) = TREE_SIDE_EFFECTS (rhs);
TREE_THIS_NOTRAP (*def_rhs_basep) = TREE_THIS_NOTRAP (rhs);
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);
+ TREE_SIDE_EFFECTS (new_rhs) = TREE_SIDE_EFFECTS (rhs);
*def_rhs_basep = saved;
fold_stmt_inplace (use_stmt_gsi);
tidy_after_forward_propagate_addr (use_stmt);