[PATCH][mem-ref] Fix DSE with pointers
Richard Guenther
rguenther@suse.de
Sun Mar 9 17:56:00 GMT 2008
Bootstrapped and "tested" on x86_64-unknown-linux-gnu, applied to the
branch.
2008-03-09 Richard Guenther <rguenther@suse.de>
* tree-ssa-dse.c (dse_possible_dead_store_p): Handle
INDIRECT_MEM_REF.
Index: mem-ref/gcc/tree-ssa-dse.c
===================================================================
*** mem-ref.orig/gcc/tree-ssa-dse.c 2008-03-09 16:20:42.000000000 +0100
--- mem-ref/gcc/tree-ssa-dse.c 2008-03-09 16:24:43.000000000 +0100
*************** dse_possible_dead_store_p (tree stmt,
*** 325,335 ****
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)
--- 325,339 ----
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)
! || TREE_CODE (base1) == INDIRECT_MEM_REF))
base1 = TREE_OPERAND (base1, 0);
! while (base2
! && (INDIRECT_REF_P (base2)
! || TREE_CODE (base2) == INDIRECT_MEM_REF))
base2 = TREE_OPERAND (base2, 0);
if (base1 != base2)
More information about the Gcc-patches
mailing list