This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR8967
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org, jh at suse dot cz, martin at xemacs dot org,dann at ics dot uci dot edu
- Date: Sat, 21 Dec 2002 19:25:53 +0100
- Subject: [PATCH] Fix PR8967
Hello,
the patch below should fix the problem. I am not quite sure about its
correctness -- there indeed should be anti_dependence in mark_used_regs,
but it does not handle the pretended set of unchanging mem after its
use. I would be much happier if there were some cleaner way.
Zdenek
Changelog:
* flow.c (init_propagate_block_info, insn_dead_p, mark_used_regs):
Eliminate dead unchanging mem stores.
*** flow.c Fri Dec 20 18:59:43 2002
--- /mnt/extra/gcc_main_rtlopt_merge/gcc/gcc/flow.c Sat Dec 21 16:38:42 2002
*************** init_propagate_block_info (bb, live, loc
*** 1996,2008 ****
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
--- 1997,2002 ----
*************** insn_dead_p (pbi, x, call_ok, notes)
*** 2177,2185 ****
If so, this memory write is dead (remember, we're walking
backwards from the end of the block to the start). Since
rtx_equal_p does not check the alias set or flags, we also
! must have the potential for them to conflict (anti_dependence). */
for (temp = pbi->mem_set_list; temp != 0; temp = XEXP (temp, 1))
! if (anti_dependence (r, XEXP (temp, 0)))
{
rtx mem = XEXP (temp, 0);
--- 2171,2179 ----
If so, this memory write is dead (remember, we're walking
backwards from the end of the block to the start). Since
rtx_equal_p does not check the alias set or flags, we also
! must have the potential for them to conflict (output_dependence). */
for (temp = pbi->mem_set_list; temp != 0; temp = XEXP (temp, 1))
! if (output_dependence (r, XEXP (temp, 0)))
{
rtx mem = XEXP (temp, 0);
*************** mark_used_regs (pbi, x, cond, insn)
*** 3791,3798 ****
while (temp)
{
next = XEXP (temp, 1);
! if (anti_dependence (XEXP (temp, 0), x))
{
/* Splice temp out of the list. */
if (prev)
--- 3785,3794 ----
while (temp)
{
+ rtx mem = XEXP (temp, 0);
next = XEXP (temp, 1);
! if (true_dependence (mem, GET_MODE (mem), x,
! rtx_addr_varies_p))
{
/* Splice temp out of the list. */
if (prev)