public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
To: gcc@gcc.gnu.org
Cc: gcc-patches@gcc.gnu.org, jh@suse.cz, martin@xemacs.org, dann@ics.uci.edu
Subject: [PATCH] Fix PR8967
Date: Sat, 21 Dec 2002 15:41:00 -0000	[thread overview]
Message-ID: <20021221182553.GA1107@atrey.karlin.mff.cuni.cz> (raw)

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)

                 reply	other threads:[~2002-12-21 18:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021221182553.GA1107@atrey.karlin.mff.cuni.cz \
    --to=rakdver@atrey.karlin.mff.cuni.cz \
    --cc=dann@ics.uci.edu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=jh@suse.cz \
    --cc=martin@xemacs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).