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]

patch to integrate.c:copy_rtx_and_substitute checked in


When inlining  a function whose return value is ignored, integrate
copies the return register unaltered, i.e. including REG_FUNCTION_VALUE_P.
As a result, when the function that contains the inlined copy is in turn
inlined, integrate thinks this hard register is still the return value,
and tries to replace it with a the lowpart of map->inline_target.
This fails on big endian when the return value from the first function
is wider than the one from the second function.

This patch fixes this by stripping REG_FUNCTION_VALUE_P when thw copying
of the first function is done.

Approved by Richard Henderson

Bootstrapped on i686-pc-linux-gnu

Sat Jan  6 00:09:34 2001  J"orn Rennecke <amylaar@redhat.com>

	* integrate.c (copy_rtx_and_substitute): When copying
	an ignored return value, strip REG_FUNCTION_VALUE_P.

Index: integrate.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/integrate.c,v
retrieving revision 1.124
diff -p -r1.124 integrate.c
*** integrate.c	2001/01/04 23:28:00	1.124
--- integrate.c	2001/01/06 08:34:22
*************** copy_rtx_and_substitute (orig, map, for_
*** 1844,1852 ****
  		 the function doesn't have a return value, error.  If the
  		 mode doesn't agree, and it ain't BLKmode, make a SUBREG.  */
  	      if (map->inline_target == 0)
! 		/* Must be unrolling loops or replicating code if we
! 		   reach here, so return the register unchanged.  */
! 		return orig;
  	      else if (GET_MODE (map->inline_target) != BLKmode
  		       && mode != GET_MODE (map->inline_target))
  		return gen_lowpart (mode, map->inline_target);
--- 1844,1861 ----
  		 the function doesn't have a return value, error.  If the
  		 mode doesn't agree, and it ain't BLKmode, make a SUBREG.  */
  	      if (map->inline_target == 0)
! 		{
! 		  if (rtx_equal_function_value_matters)
! 		    /* This is an ignored return value.  We must not
! 		       leave it in with REG_FUNCTION_VALUE_P set, since
! 		       that would confuse subsequent inlining of the
! 		       current function into a later function.  */
! 		    return gen_rtx_REG (GET_MODE (orig), regno);
! 		  else
! 		    /* Must be unrolling loops or replicating code if we
! 		       reach here, so return the register unchanged.  */
! 		    return orig;
! 		}
  	      else if (GET_MODE (map->inline_target) != BLKmode
  		       && mode != GET_MODE (map->inline_target))
  		return gen_lowpart (mode, map->inline_target);

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