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: [Patch] MIPS: Supply correct call clobbered information for global pointer.


Richard Sandiford wrote:
David Daney <ddaney@avtrex.com> writes:
This patch supplies correct call clobbered information for the global
pointer for the o32 and o64 ABIs.

Thanks for the patch. Unfortunately, although this is clearly correct information at the ABI level, I don't think it's correct at the RTL level. Until the call patterns are split -- if they ever are -- the patterns include code to restore $gp. This means that $gp is preserved across the unsplit call instructions, and that the current non-definition of PIC_OFFSET_TABLE_REG_CALL_CLOBBERED is correct at that point.

The post-split calls explicitly clobber $gp, so I think we are already
providing correct information as far as the call instructions themselves
are concerned.  I'm not claiming I can construct a test that wouldn't
work after the patch (to be honest, I haven't even tried).  But it seems
dangerous in principle.

I've got a series of patches that I hope to submit before 4.4 is out.
As it happens, one of those patches included a fix for the same problem,
so I've split it out here.  It brings about a 0.75% improvement in the
CSiBE score for little-endian MIPS64 code at -Os.

If you're happy with this approach, I can commit the patch separately
from the other stuff.  (I'll test it on its own overnight.)


Eliminating the dead code is my main concern. I have not tested your patch, but assume that it is as effective as mine in eliminating the dead restore of $gp.


One thing that concerns me is that it feels like we are lying to data-flow. In df-scan.c (df_get_exit_block_use_set) PIC_OFFSET_TABLE_REG_CALL_CLOBBERED is used to check if $gp is used in the exit block, which it is not in TARGET_OLDABI.

Since you are the maintainer and have a preference for your patch, you should commit it. I have no objection to it.


David Daney



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