public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, PPC] Fix PR88343.
@ 2018-12-05 17:10 Iain Sandoe
  2018-12-05 18:12 ` Segher Boessenkool
  0 siblings, 1 reply; 2+ messages in thread
From: Iain Sandoe @ 2018-12-05 17:10 UTC (permalink / raw)
  To: GCC-patches; +Cc: Segher Boessenkool

Hi,

The PR is about unnecessary saves of the pic base register, it shows on m32 Linux and m32/m64 Darwin.

The fix is to check that we are in a pic mode and that the picbase has actually been used.
As a bonus, some #ifdef’d TARGET_MACHO code is no longer required.

Tested on power7, bootstrapped on Darwin (testing continues).

OK for trunk?

Branches?

Iain

2018-xx-xx  Segher Boessenkool  <segher@kernel.crashing.org>
	   Iain Sandoe  <iain@sandoe.co.uk>

gcc/
	* config/rs6000/rs6000.c (save_reg_p): Do not save the picbase reg
	unless it has been used.  (first_reg_to_save): Remove dead code.


diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index dfd5303..380cf9d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -23961,7 +23961,7 @@ save_reg_p (int reg)
 	return true;
 
       if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)
-	  && flag_pic)
+	  && flag_pic && crtl->uses_pic_offset_table)
 	return true;
     }
 
@@ -23981,13 +23981,6 @@ first_reg_to_save (void)
     if (save_reg_p (first_reg))
       break;
 
-#if TARGET_MACHO
-  if (flag_pic
-      && crtl->uses_pic_offset_table
-      && first_reg > RS6000_PIC_OFFSET_TABLE_REGNUM)
-    return RS6000_PIC_OFFSET_TABLE_REGNUM;
-#endif
-
   return first_reg;
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, PPC] Fix PR88343.
  2018-12-05 17:10 [PATCH, PPC] Fix PR88343 Iain Sandoe
@ 2018-12-05 18:12 ` Segher Boessenkool
  0 siblings, 0 replies; 2+ messages in thread
From: Segher Boessenkool @ 2018-12-05 18:12 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC-patches

On Wed, Dec 05, 2018 at 05:10:07PM +0000, Iain Sandoe wrote:
> Hi,
> 
> The PR is about unnecessary saves of the pic base register, it shows on m32 Linux and m32/m64 Darwin.
> 
> The fix is to check that we are in a pic mode and that the picbase has actually been used.
> As a bonus, some #ifdef’d TARGET_MACHO code is no longer required.
> 
> Tested on power7, bootstrapped on Darwin (testing continues).
> 
> OK for trunk?

Okay for trunk if testing completes successfully :-)  Thanks!

> Branches?

Sure.  Please let is soak on trunk for a week first; and don't do 7
until 7.4 has been made?


> 2018-xx-xx  Segher Boessenkool  <segher@kernel.crashing.org>
> 	   Iain Sandoe  <iain@sandoe.co.uk>
> 
> gcc/
> 	* config/rs6000/rs6000.c (save_reg_p): Do not save the picbase reg
> 	unless it has been used.  (first_reg_to_save): Remove dead code.

Your changelogs still wrap (the second "(" should start a new line).


Segher

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-05 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05 17:10 [PATCH, PPC] Fix PR88343 Iain Sandoe
2018-12-05 18:12 ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).