This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Small flow dead/store elimination improvement
- To: patches at x86-64 dot org, rth at cygnus dot com, gcc-patches at gcc dot gnu dot org
- Subject: Small flow dead/store elimination improvement
- From: Jan Hubicka <jh at suse dot cz>
- Date: Tue, 20 Feb 2001 16:34:03 +0100
Hi
This patch slightly improves dead store detection of flow.c by using alias
analysis and single_set. This is needed to remove x86_64 va_arg prologue
instructions I am using currently, but adds bit more matches in other cases as
well.
Tue Feb 20 16:32:39 CET 2001 Jan Hubicka <jh@suse.cz>
* flow.c (init_propagate_block_info): Canon address and use single_set
for killing dead memory stores.
Index: gcc/gcc/flow.c
===================================================================
RCS file: /home/cvs/Repository/gcc/gcc/flow.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 flow.c
*** gcc/gcc/flow.c 2001/02/14 13:57:25 1.13
--- gcc/gcc/flow.c 2001/02/20 15:28:20
*************** init_propagate_block_info (bb, live, loc
*** 4090,4114 ****
|| (bb->succ->succ_next == NULL
&& bb->succ->dest == EXIT_BLOCK_PTR)))
{
! rtx insn;
for (insn = bb->end; insn != bb->head; insn = PREV_INSN (insn))
if (GET_CODE (insn) == INSN
! && GET_CODE (PATTERN (insn)) == SET
! && GET_CODE (SET_DEST (PATTERN (insn))) == MEM)
{
! rtx mem = SET_DEST (PATTERN (insn));
/* This optimization is performed by faking a store to the
memory at the end of the block. This doesn't work for
unchanging memories because multiple stores to unchanging
memory is illegal and alias analysis doesn't consider it. */
! if (RTX_UNCHANGING_P (mem))
continue;
! if (XEXP (mem, 0) == frame_pointer_rtx
! || (GET_CODE (XEXP (mem, 0)) == PLUS
! && XEXP (XEXP (mem, 0), 0) == frame_pointer_rtx
! && GET_CODE (XEXP (XEXP (mem, 0), 1)) == CONST_INT))
{
#ifdef AUTO_INC_DEC
/* Store a copy of mem, otherwise the address may be scrogged
--- 4090,4115 ----
|| (bb->succ->succ_next == NULL
&& bb->succ->dest == EXIT_BLOCK_PTR)))
{
! rtx insn, set;
for (insn = bb->end; insn != bb->head; insn = PREV_INSN (insn))
if (GET_CODE (insn) == INSN
! && (set = single_set (insn))
! && GET_CODE (SET_DEST (set)) == MEM)
{
! rtx mem = SET_DEST (set);
! rtx canon_mem = canon_rtx (mem);
/* This optimization is performed by faking a store to the
memory at the end of the block. This doesn't work for
unchanging memories because multiple stores to unchanging
memory is illegal and alias analysis doesn't consider it. */
! if (RTX_UNCHANGING_P (canon_mem))
continue;
! if (XEXP (canon_mem, 0) == frame_pointer_rtx
! || (GET_CODE (XEXP (canon_mem, 0)) == PLUS
! && XEXP (XEXP (canon_mem, 0), 0) == frame_pointer_rtx
! && GET_CODE (XEXP (XEXP (canon_mem, 0), 1)) == CONST_INT))
{
#ifdef AUTO_INC_DEC
/* Store a copy of mem, otherwise the address may be scrogged