This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC-3.3.4 PATCH: PR 13472


Bootstrapped and regtested on an i686-pc-linux-gnu.

-- Gaby

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 1.16114.2.935
diff -p -r1.16114.2.935 ChangeLog
*** ChangeLog	12 Mar 2004 22:56:34 -0000	1.16114.2.935
--- ChangeLog	13 Mar 2004 00:29:26 -0000
***************
*** 1,4 ****
--- 1,11 ----
  2004-03-12  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+         
+         Endorse:
+ 	2004-01-10  Eric Botcazou  <ebotcazou@libertysurf.fr>
+ 	PR optimization/13472
+ 	* reload.c (reload): Don't record unchanging memory locations.
+ 
+ 2004-03-12  Gabriel Dos Reis  <gdr@integrable-solutions.net>
  
  	Backport
  	2004-02-27  Mark Mitchell  <mark@codesourcery.com>
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.366.2.9
diff -p -r1.366.2.9 reload1.c
*** reload1.c	5 Mar 2004 20:16:49 -0000	1.366.2.9
--- reload1.c	13 Mar 2004 00:29:32 -0000
*************** reload (first, global)
*** 789,796 ****
  		     that is not a legitimate memory operand.  As later
  		     stages of reload assume that all addresses found
  		     in the reg_equiv_* arrays were originally legitimate,
! 		     we ignore such REG_EQUIV notes.  */
! 		  if (memory_operand (x, VOIDmode))
  		    {
  		      /* Always unshare the equivalence, so we can
  			 substitute into this insn without touching the
--- 789,806 ----
  		     that is not a legitimate memory operand.  As later
  		     stages of reload assume that all addresses found
  		     in the reg_equiv_* arrays were originally legitimate,
! 		     we ignore such REG_EQUIV notes.
! 
! 		     It also can happen that a REG_EQUIV note contains a MEM
! 		     that carries the /u flag, for example when GCSE turns
! 		     the load of a constant into a move from a pseudo that
! 		     already contains the constant and attaches a REG_EQUAL
! 		     note to the insn, which is later promoted to REQ_EQUIV
! 		     by local-alloc.  If the destination pseudo happens not
! 		     to be assigned to a hard reg, it will be replaced by
! 		     the MEM as the destination of the move, thus generating
! 		     a store to a possibly read-only memory location.  */
! 		  if (memory_operand (x, VOIDmode) && ! RTX_UNCHANGING_P (x))
  		    {
  		      /* Always unshare the equivalence, so we can
  			 substitute into this insn without touching the
Index: testsuite/gcc.dg/const-1.c
===================================================================
RCS file: testsuite/gcc.dg/const-1.c
diff -N testsuite/gcc.dg/const-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/gcc.dg/const-1.c	13 Mar 2004 00:29:35 -0000
***************
*** 0 ****
--- 1,56 ----
+ /* PR optimization/13472 */
+ /* Origin: <p.van-hoof@qub.ac.uk> */
+ 
+ /* Verify that the reload pass doesn't emit a store
+    to the .rodata section. */
+ 
+ /* { dg-do run } */
+ /* { dg-options "-O2 -pedantic -march=i686" { target i686-*-* } } */
+ 
+ 
+ #define MAX2(a,b) (((a)>(b)) ? (a) : (b))
+ 
+ const int q=0, p=0;
+ 
+ typedef struct {
+ 	float a;
+ 	float b;
+ } F;
+ 
+ F **E, *D, C = { 2.f, 1.f };
+ 
+ void G(float);
+ void H(void);
+ 
+ int main(void)
+ {
+ 	D = &C;
+ 	E = &D;
+ 
+ 	H();
+         return 0;
+ }
+ 
+ void H(void)
+ {
+ 	int i, l=1;
+ 	float b, o;
+ 
+ 	if( l )
+ 	{
+ 		b = 0.3f * MAX2(0.f,E[q][p].a - E[q][p].b);
+ 		o = E[q][p].a;
+ 		if( o > 1.e-36f )
+                         G(o);
+ 		E[q][p].a *= b;
+ 	}
+ 	else
+ 		b = 1.f;
+ 	for( i=q; i<2; ++i )
+ 		;
+ }
+ 
+ void G(float o)
+ {
+ }
+ 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]