public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Alan Modra <amodra@bigpond.net.au>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: optimization/6233: simple loop miscompilation
Date: Tue, 09 Apr 2002 18:06:00 -0000	[thread overview]
Message-ID: <20020410010601.13937.qmail@sources.redhat.com> (raw)

The following reply was made to PR optimization/6233; it has been noted by GNATS.

From: Alan Modra <amodra@bigpond.net.au>
To: Richard Henderson <rth@redhat.com>, gcc-gnats@gcc.gnu.org,
  gcc-patches@gcc.gnu.org
Cc:  
Subject: Re: optimization/6233: simple loop miscompilation
Date: Wed, 10 Apr 2002 10:32:37 +0930

 On Tue, Apr 09, 2002 at 05:41:07PM -0700, Richard Henderson wrote:
 > On Wed, Apr 10, 2002 at 09:30:14AM +0930, Alan Modra wrote:
 > > Sledgehammer to crack a nut?  Should I instead specifically search
 > > for the use_mem_scratch?
 > 
 > Please.
 
 OK.  i686-linux native bootstrap and reg test in progress.
 
 	* rtlanal.c (pure_call_p): New function.
 	* rtl.h (pure_call_p): Declare.
 	* loop.c (prescan_loop): Use it to set has_nonconst_call.
 
 Index: gcc/loop.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/loop.c,v
 retrieving revision 1.394
 diff -u -p -r1.394 loop.c
 --- gcc/loop.c	3 Apr 2002 07:56:44 -0000	1.394
 +++ gcc/loop.c	10 Apr 2002 00:56:54 -0000
 @@ -2493,6 +2493,8 @@ prescan_loop (loop)
  	      loop_info->unknown_address_altered = 1;
  	      loop_info->has_nonconst_call = 1;
  	    }
 +	  else if (pure_call_p (insn))
 +	    loop_info->has_nonconst_call = 1;
  	  loop_info->has_call = 1;
  	  if (can_throw_internal (insn))
  	    loop_info->has_multiple_exit_targets = 1;
 Index: gcc/rtl.h
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
 retrieving revision 1.337
 diff -u -p -r1.337 rtl.h
 --- gcc/rtl.h	1 Apr 2002 03:18:49 -0000	1.337
 +++ gcc/rtl.h	10 Apr 2002 00:56:56 -0000
 @@ -1502,6 +1502,7 @@ extern rtx find_reg_equal_equiv_note	PAR
  extern int find_reg_fusage		PARAMS ((rtx, enum rtx_code, rtx));
  extern int find_regno_fusage		PARAMS ((rtx, enum rtx_code,
  						 unsigned int));
 +extern int pure_call_p			PARAMS ((rtx));
  extern void remove_note			PARAMS ((rtx, rtx));
  extern int side_effects_p		PARAMS ((rtx));
  extern int volatile_refs_p		PARAMS ((rtx));
 Index: gcc/rtlanal.c
 ===================================================================
 RCS file: /cvs/gcc/gcc/gcc/rtlanal.c,v
 retrieving revision 1.130
 diff -u -p -r1.130 rtlanal.c
 --- gcc/rtlanal.c	28 Mar 2002 12:25:18 -0000	1.130
 +++ gcc/rtlanal.c	10 Apr 2002 00:56:58 -0000
 @@ -2011,6 +2011,31 @@ find_regno_fusage (insn, code, regno)
  
    return 0;
  }
 +
 +/* Return true if INSN is a call to a pure function.  */
 +
 +int
 +pure_call_p (insn)
 +     rtx insn;
 +{
 +  rtx link;
 +
 +  if (GET_CODE (insn) != CALL_INSN || ! CONST_OR_PURE_CALL_P (insn))
 +    return 0;
 +
 +  /* Look for the note that differentiates const and pure functions.  */
 +  for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
 +    {
 +      rtx u, m;
 +
 +      if (GET_CODE (u = XEXP (link, 0)) == USE
 +	  && GET_CODE (m = XEXP (u, 0)) == MEM && GET_MODE (m) == BLKmode
 +	  && GET_CODE (XEXP (m, 0)) == SCRATCH)
 +	return 1;
 +    }
 +
 +  return 0;
 +}
  \f
  /* Remove register note NOTE from the REG_NOTES of INSN.  */
  
 -- 
 Alan Modra
 IBM OzLabs - Linux Technology Centre


             reply	other threads:[~2002-04-10  1:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-09 18:06 Alan Modra [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-04-09 19:06 Richard Henderson
2002-04-09 17:46 Richard Henderson
2002-04-09 17:06 Alan Modra
2002-04-09  9:46 Richard Henderson
2002-04-09  6:46 Alan Modra
2002-04-09  4:36 Alan Modra
2002-04-08 21:36 amodra

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=20020410010601.13937.qmail@sources.redhat.com \
    --to=amodra@bigpond.net.au \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@gcc.gnu.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).