diff options
Diffstat (limited to 'gcc-4.6/gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc-4.6/gcc/tree-ssa-forwprop.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/gcc-4.6/gcc/tree-ssa-forwprop.c b/gcc-4.6/gcc/tree-ssa-forwprop.c index 4728f1b..7e1e7c0 100644 --- a/gcc-4.6/gcc/tree-ssa-forwprop.c +++ b/gcc-4.6/gcc/tree-ssa-forwprop.c @@ -872,7 +872,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; @@ -890,8 +890,13 @@ 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); - gimple_assign_set_lhs (use_stmt, - unshare_expr (TREE_OPERAND (def_rhs, 0))); + 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 @@ -942,16 +947,16 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tidy_after_forward_propagate_addr (use_stmt); return res; } - /* If the LHS is a plain dereference and the value type is the same as + /* If the RHS is a plain dereference and the value type is the same as that of the pointed-to type of the address we can put the - dereferenced address on the LHS preserving the original alias-type. */ + dereferenced address on the RHS preserving the original alias-type. */ else if (gimple_assign_rhs1 (use_stmt) == rhs && useless_type_conversion_p (TREE_TYPE (gimple_assign_lhs (use_stmt)), 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; @@ -969,8 +974,13 @@ 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); - gimple_assign_set_rhs1 (use_stmt, - unshare_expr (TREE_OPERAND (def_rhs, 0))); + 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); tidy_after_forward_propagate_addr (use_stmt); |