1 GCC regressions, 0 new, with your patch on 2001-08-31T19:09:26Z.

Jan Hubicka jh@suse.cz
Sat Sep 1 11:01:00 GMT 2001


> On Fri, Aug 31, 2001 at 09:13:55PM +0000, GCC regression checker wrote:
> > The old failures, which were not fixed or introduced by your patch, are:
> > native g++.sum g++.eh/terminate2.C
> 
> Jan, I'm pretty sure this is caused by
> 
> > +Sat Aug 25 23:07:35 CEST 2001  Jan Hubicka  <jh@suse.cz>
> > +
> > +	* predict.c (expensive_function_p): New.
> > +	* rtl.h (expensive_function_p): Declare.
> > +	* i386.c (FAST_PROLOGUE_INSN_COUNT): New constant.
> > +	(use_fast_prologue_epilogue): New static variable.
> > +	(expand_prologue): Set it; emit short prologues if unset.
> > +	(expand_epilogue): Likewise.
> 
> Would you look into it?

Hi,
the problem is an latent bug in expand_epilogue. When sequence with
push instructions is used, ix86_save_regs is called with false argument.
This cause us to miss restore of register used for exception handling, but
when push/pop instructions don't match, we get bad results.

While hunting down the bug I've noticed other glitches - mainly
the use_mov/fast_epilogue is set imporperly, the optimize_size is
redundantly used on some places and we can avoid dependancy chain by
emitting leave, instead of last pop (leave use ebp as it's arugment,
not esp recently changes by preceeding pops).

Bootstraping/regtesting i386.

Honza

Sat Sep  1 19:54:43 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* i386.c (ix86_expand_prologue): Set use_fast_prologue_epilogue
	properly.
	(ix86_expand_epilogue): Avoid dummy optimize_size tests;
	use leave to avoid depdendancy chain.

Index: i386.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.300
diff -c -3 -p -r1.300 i386.c
*** i386.c	2001/08/25 21:08:28	1.300
--- i386.c	2001/09/01 17:53:50
*************** ix86_expand_prologue ()
*** 2664,2674 ****
    int use_mov = 0;
    HOST_WIDE_INT allocate;
  
!   if (TARGET_PROLOGUE_USING_MOVE && !optimize_size)
      {
        use_fast_prologue_epilogue
  	 = !expensive_function_p (FAST_PROLOGUE_INSN_COUNT);
!       use_mov = use_fast_prologue_epilogue;
      }
    ix86_compute_frame_layout (&frame);
  
--- 2664,2675 ----
    int use_mov = 0;
    HOST_WIDE_INT allocate;
  
!   if (!optimize_size)
      {
        use_fast_prologue_epilogue
  	 = !expensive_function_p (FAST_PROLOGUE_INSN_COUNT);
!       if (TARGET_PROLOGUE_USING_MOVE)
!         use_mov = use_fast_prologue_epilogue;
      }
    ix86_compute_frame_layout (&frame);
  
*************** ix86_expand_epilogue (style)
*** 2807,2817 ****
       and there is exactly one register to pop. This heruistic may need some
       tuning in future.  */
    if ((!sp_valid && frame.nregs <= 1)
!       || (TARGET_EPILOGUE_USING_MOVE && !optimize_size
  	  && use_fast_prologue_epilogue
  	  && (frame.nregs > 1 || frame.to_allocate))
        || (frame_pointer_needed && !frame.nregs && frame.to_allocate)
!       || (frame_pointer_needed && TARGET_USE_LEAVE && !optimize_size
  	  && use_fast_prologue_epilogue && frame.nregs == 1)
        || style == 2)
      {
--- 2808,2818 ----
       and there is exactly one register to pop. This heruistic may need some
       tuning in future.  */
    if ((!sp_valid && frame.nregs <= 1)
!       || (TARGET_EPILOGUE_USING_MOVE
  	  && use_fast_prologue_epilogue
  	  && (frame.nregs > 1 || frame.to_allocate))
        || (frame_pointer_needed && !frame.nregs && frame.to_allocate)
!       || (frame_pointer_needed && TARGET_USE_LEAVE
  	  && use_fast_prologue_epilogue && frame.nregs == 1)
        || style == 2)
      {
*************** ix86_expand_epilogue (style)
*** 2890,2896 ****
  		    GEN_INT (frame.to_allocate)));
  
        for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
! 	if (ix86_save_reg (regno, false))
  	  {
  	    if (TARGET_64BIT)
  	      emit_insn (gen_popdi1 (gen_rtx_REG (Pmode, regno)));
--- 2891,2897 ----
  		    GEN_INT (frame.to_allocate)));
  
        for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
! 	if (ix86_save_reg (regno, true))
  	  {
  	    if (TARGET_64BIT)
  	      emit_insn (gen_popdi1 (gen_rtx_REG (Pmode, regno)));
*************** ix86_expand_epilogue (style)
*** 2899,2905 ****
  	  }
        if (frame_pointer_needed)
  	{
! 	  if (TARGET_64BIT)
  	    emit_insn (gen_popdi1 (hard_frame_pointer_rtx));
  	  else
  	    emit_insn (gen_popsi1 (hard_frame_pointer_rtx));
--- 2900,2910 ----
  	  }
        if (frame_pointer_needed)
  	{
! 	  /* Leave results in shorter depdendancy chains on CPUs that are
! 	     able to grok it fast.  */
! 	  if (TARGET_USE_LEAVE)
! 	    emit_insn (TARGET_64BIT ? gen_leave_rex64 () : gen_leave ());
! 	  else if (TARGET_64BIT)
  	    emit_insn (gen_popdi1 (hard_frame_pointer_rtx));
  	  else
  	    emit_insn (gen_popsi1 (hard_frame_pointer_rtx));



More information about the Gcc-regression mailing list