aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2013-06-12 19:56:30 +0200
committerMarc Glisse <glisse@gcc.gnu.org>2013-06-12 17:56:30 +0000
commit1951f1016cd8eec62db59a76840bde6a61d53ad4 (patch)
tree324bf4aca8069a6f23641b2b376e381099a0ca1e /gcc/tree-ssa-dse.c
parent8b033a8a927afab88532af22bdb7cd87d57e1f6d (diff)
downloadgcc-1951f1016cd8eec62db59a76840bde6a61d53ad4.zip
gcc-1951f1016cd8eec62db59a76840bde6a61d53ad4.tar.gz
gcc-1951f1016cd8eec62db59a76840bde6a61d53ad4.tar.bz2
re PR tree-optimization/57361 (Remove self memory assignment)
2013-06-12 Marc Glisse <marc.glisse@inria.fr> PR tree-optimization/57361 gcc/ * tree-ssa-dse.c (dse_possible_dead_store_p): Handle self-assignment. gcc/testsuite/ * gcc.dg/tree-ssa/pr57361.c: New file. From-SVN: r200034
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r--gcc/tree-ssa-dse.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index ad99ea9..39f47ab 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -84,6 +84,13 @@ dse_possible_dead_store_p (gimple stmt, gimple *use_stmt)
*use_stmt = NULL;
+ /* Self-assignments are zombies. */
+ if (operand_equal_p (gimple_assign_rhs1 (stmt), gimple_assign_lhs (stmt), 0))
+ {
+ *use_stmt = stmt;
+ return true;
+ }
+
/* Find the first dominated statement that clobbers (part of) the
memory stmt stores to with no intermediate statement that may use
part of the memory stmt stores. That is, find a store that may