Recent 3.2 branch commits cause x86 -fPIC regressions

Richard Henderson rth@redhat.com
Tue Sep 17 14:24:00 GMT 2002


On Wed, Sep 18, 2002 at 12:15:52AM +0930, Alan Modra wrote:
> The recursive call looks bad to me.  Insns marked *** ought to be swapped,
> I think.
> 
>  8048570:       8b 44 24 40             mov    0x40(%esp,1),%eax
>  8048574:       89 ee                   mov    %ebp,%esi
>  8048576:       8b 54 24 44             mov    0x44(%esp,1),%edx
>  804857a:       89 74 24 4c             mov    %esi,0x4c(%esp,1)  ***
>  804857e:       8b 6c 24 4c             mov    0x4c(%esp,1),%ebp  ***

Indeed.  It's Yet Another RTX_UNCHANGING_P bug.

Fixed thus.


r~


        * sibcall.c (optimize_sibling_and_tail_recursive_call): Also remove
        RTX_UNCHANGING_P markers for successful tail-recursive replacement.

Index: sibcall.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sibcall.c,v
retrieving revision 1.29.2.2
diff -c -p -d -r1.29.2.2 sibcall.c
*** sibcall.c	6 Apr 2002 19:37:38 -0000	1.29.2.2
--- sibcall.c	17 Sep 2002 21:19:02 -0000
*************** optimize_sibling_and_tail_recursive_call
*** 574,581 ****
    rtx insn, insns;
    basic_block alternate_exit = EXIT_BLOCK_PTR;
    bool no_sibcalls_this_function = false;
!   int successful_sibling_call = 0;
!   int replaced_call_placeholder = 0;
    edge e;
  
    insns = get_insns ();
--- 574,581 ----
    rtx insn, insns;
    basic_block alternate_exit = EXIT_BLOCK_PTR;
    bool no_sibcalls_this_function = false;
!   bool successful_replacement = false;
!   bool replaced_call_placeholder = false;
    edge e;
  
    insns = get_insns ();
*************** optimize_sibling_and_tail_recursive_call
*** 715,724 ****
  	  /* Select a set of insns to implement the call and emit them.
  	     Tail recursion is the most efficient, so select it over
  	     a tail/sibling call.  */
- 	  if (sibcall)
- 	    successful_sibling_call = 1;
  
! 	  replaced_call_placeholder = 1;
  	  replace_call_placeholder (insn, 
  				    tailrecursion != 0 
  				      ? sibcall_use_tail_recursion
--- 715,725 ----
  	  /* Select a set of insns to implement the call and emit them.
  	     Tail recursion is the most efficient, so select it over
  	     a tail/sibling call.  */
  
! 	  if (sibcall || tailrecursion)
! 	    successful_replacement = true;
! 	  replaced_call_placeholder = true;
! 
  	  replace_call_placeholder (insn, 
  				    tailrecursion != 0 
  				      ? sibcall_use_tail_recursion
*************** optimize_sibling_and_tail_recursive_call
*** 728,734 ****
  	}
      }
  
!   if (successful_sibling_call)
      {
        rtx insn;
        tree arg;
--- 729,735 ----
  	}
      }
  
!   if (successful_replacement)
      {
        rtx insn;
        tree arg;



More information about the Gcc-patches mailing list