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]

Re: [3.3 PATCH] Fix PR optimization/13472


> 2004-01-10  Eric Botcazou  <ebotcazou@libertysurf.fr>
>
> 	PR optimization/13472
> 	* reload.c (reload): Don't record unchanging memory locations.

Correction: it's reload1.c instead.


Amazingly, this patch fixes PR target/13634, a regression on the 3.3 branch 
too.  Reload manages to generate a store to a FP constant for the testcase

double pow(double); 
 
int icvCubicV(double a2) 
{ 
  double p; 
  int i=0; 
   
  p = a2 / 3; 
  while(i<6) ++i; 
 
  return pow( 1./ 3. ) +  
    ( a2<0.0 ? -1.0: 1.0  )  *  p  / 3; 
} 


(insn:HI 98 74 36 2 (nil) (set (mem/u/f:DF (plus:SI (reg:SI 3 ebx)
                (const:SI (unspec:SI [
                            (symbol_ref/u:SI ("*.LC0"))
                        ] 1))) [2 S8 A64])
        (const_double:DF -1431655766 [0xaaaaaaaa] 
3.33333333333333314829616256247390992939472198486e-1 
[0x0.aaaaaaaaaaaaa8p-1])) 65 {*movdf_nointeger} (nil)
    (expr_list:REG_EQUIV (mem/u/f:DF (plus:SI (reg:SI 3 ebx)
                (const:SI (unspec:SI [
                            (symbol_ref/u:SI ("*.LC0"))
                        ] 1))) [2 S8 A64])
        (nil)))


so the patch prevents that and the ICE goes away.


Is this a well-known fact that reload can generate stores to read-only 
locations?  And there is an additional concern on mainline: if a constant is 
not initialized in the same translation unit as its definition, the /u flag 
is not set anymore, because of

2002-12-13  Jason Merrill  <jason@redhat.com>

	* tree.h (CALL_EXPR_HAS_RETURN_SLOT_ADDR): New macro.
	* calls.c (expand_call): Handle it.
	* tree-inline.c (struct inline_data): Remove target_exprs field.
	(optimize_inline_calls): Don't initialize it.
	(expand_call_inline): Don't modify it.  Handle
	CALL_EXPR_HAS_RETURN_SLOT_ADDR.
	(declare_return_variable): Take return slot addr.
	* langhooks.h (copy_res_decl_for_inlining): Change target_exprs parm
	to return_slot_addr.
	* langhooks-def.h, langhooks.c: Adjust.
	* explow.c (maybe_set_unchanging): Don't set RTX_UNCHANGING_P for
	a decl with no DECL_INITIAL.

-- 
Eric Botcazou


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