diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-09 10:04:24 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-09 10:04:24 +0000 |
commit | f6e2e4ff99df210ee3d2e9f6c41e5bb06c9790a6 (patch) | |
tree | e2fa3b193c0435960fdf15ebaca3ceb42dc9c985 /gcc/tree-ssa-forwprop.c | |
parent | 9e94149207097da2e65b90be18c4db2954a9abec (diff) | |
download | gcc-f6e2e4ff99df210ee3d2e9f6c41e5bb06c9790a6.tar.gz |
PR tree-optimization/56854
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Don't
forward into clobber stmts if it would change MEM_REF lhs into
non-MEM_REF.
* g++.dg/torture/pr56854.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197625 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index edcf92918b7..26b076146d3 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -826,7 +826,11 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, && integer_zerop (TREE_OPERAND (lhs, 1)) && useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (def_rhs, 0)), - TREE_TYPE (gimple_assign_rhs1 (use_stmt)))) + TREE_TYPE (gimple_assign_rhs1 (use_stmt))) + /* Don't forward anything into clobber stmts if it would result + in the lhs no longer being a MEM_REF. */ + && (!gimple_clobber_p (use_stmt) + || TREE_CODE (TREE_OPERAND (def_rhs, 0)) == MEM_REF)) { tree *def_rhs_basep = &TREE_OPERAND (def_rhs, 0); tree new_offset, new_base, saved, new_lhs; |