[Bug target/10681] [3.3/3.4 regression] [IA64] ICE in ia64_expand_epilogue

wilson at tuliptree dot org gcc-bugzilla@gcc.gnu.org
Wed Jun 25 01:50:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10681



------- Additional Comments From wilson at tuliptree dot org  2003-06-25 00:56 -------
Subject: Re:  [3.3/3.4 regression] [IA64] ICE in
 ia64_expand_epilogue

I believe this is the correct fix.  It used to be that we didn't save 
ar.pfs in leaf functions, now we can if it is clobbered by an asm.  So 
we need to check the mask bit instead of current_function_is_leaf.  The 
code in the prologue was fixed in the original patch, but the epilogue 
code was missed.

This testcase however points out a problem.  This function doesn't have 
an asm, and it is a leaf function after the sibling calls optimization. 
   So there is no need to save/restore ar.pfs.  The problem here is that 
the sibling call at the end of the function looks like it uses ar.pfs, 
and we can't distinguish that from an asm by looking at regs_ever_live. 
  I added a comment to document this inefficiency.

I don't have access to IA-64 hardware (because I'm lazy), so I can't 
test this.

Jim
2003-06-24  James E Wilson  <wilson@tuliptree.org>

	* config/ia64/ia64.c (ia64_compute_frame_size): Add comment about
	saving ar.pfs in leaf function that ends with sibling call.
	(ia64_expand_epilogue): Check ar.pfs mask bit instead of
	current_function_is_leaf when restoring ar.pfs.

Index: ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.198.2.8
diff -p -r1.198.2.8 ia64.c
*** ia64.c	26 Apr 2003 20:37:40 -0000	1.198.2.8
--- ia64.c	24 Jun 2003 23:51:13 -0000
*************** ia64_compute_frame_size (size)
*** 1875,1880 ****
--- 1875,1882 ----
  	  n_spilled += 1;
  	}
  
+       /* ??? If this is a leaf function that ends with a sibling call, then
+ 	 there is no need to save ar.pfs even though it is live here.  */
        if (regs_ever_live[AR_PFS_REGNUM])
  	{
  	  SET_HARD_REG_BIT (mask, AR_PFS_REGNUM);
*************** ia64_expand_epilogue (sibcall_p)
*** 2746,2752 ****
        reg = gen_rtx_REG (DImode, AR_PFS_REGNUM);
        emit_move_insn (reg, alt_reg);
      }
!   else if (! current_function_is_leaf)
      {
        alt_regno = next_scratch_gr_reg ();
        alt_reg = gen_rtx_REG (DImode, alt_regno);
--- 2748,2754 ----
        reg = gen_rtx_REG (DImode, AR_PFS_REGNUM);
        emit_move_insn (reg, alt_reg);
      }
!   else if (TEST_HARD_REG_BIT (current_frame_info.mask, AR_PFS_REGNUM))
      {
        alt_regno = next_scratch_gr_reg ();
        alt_reg = gen_rtx_REG (DImode, alt_regno);



More information about the Gcc-bugs mailing list