re PR tree-optimization/30375 (tree-ssa-dse incorrectly removes struct initialization)

PR tree-optimization/30375
        * tree-ssa-dse.c (dse_possible_dead_store_p): Do not eliminate if
        LHS of statements is not the same.
        * testsuite/gcc.dg/tree-ssa/ssa-dse-10.c: New.

From-SVN: r122758
This commit is contained in:
Aldy Hernandez 2007-03-09 20:05:08 +00:00 committed by Aldy Hernandez
parent 3f868e1cef
commit 0f84b06679
3 changed files with 1556 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2007-03-09 Aldy Hernandez <aldyh@redhat.com>
PR tree-optimization/30375
* tree-ssa-dse.c (dse_possible_dead_store_p): Do not eliminate if
LHS of statements is not the same.
* testsuite/gcc.dg/tree-ssa/ssa-dse-10.c: New.
2007-03-09 Chao-ying Fu <fu@mips.com>
* doc/extend.texi (MIPS DSP Built-in Functions): Document the DSP

File diff suppressed because it is too large Load Diff

View File

@ -283,6 +283,32 @@ dse_possible_dead_store_p (tree stmt,
gcc_assert (*use_p != NULL_USE_OPERAND_P);
*first_use_p = *use_p;
/* In the case of memory partitions, we may get:
# MPT.764_162 = VDEF <MPT.764_161(D)>
x = {};
# MPT.764_167 = VDEF <MPT.764_162>
y = {};
So we must make sure we're talking about the same LHS.
*/
if (TREE_CODE (temp) == GIMPLE_MODIFY_STMT)
{
tree base1 = get_base_address (GIMPLE_STMT_OPERAND (stmt, 0));
tree base2 = get_base_address (GIMPLE_STMT_OPERAND (temp, 0));
while (base1 && INDIRECT_REF_P (base1))
base1 = TREE_OPERAND (base1, 0);
while (base2 && INDIRECT_REF_P (base2))
base2 = TREE_OPERAND (base2, 0);
if (base1 != base2)
{
fail = true;
break;
}
}
/* If the immediate use of DEF_VAR is not the same as the
previously find immediate uses, then we will not be able
to eliminate STMT. */