From: Segher Boessenkool Date: Wed, 12 Dec 2018 08:53:49 +0000 (+0100) Subject: rs6000 - Fix PR target/88343 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=be611c9c5a544b08cfd3ff5d45b04a127d4d055f;p=gcc.git rs6000 - Fix PR target/88343 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. 2018-12-12 Segher Boessenkool Iain Sandoe PR target/88343 * 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. Co-Authored-By: Iain Sandoe From-SVN: r267049 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c561bce2627..2a6916b95ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-12-12 Segher Boessenkool + Iain Sandoe + + PR target/88343 + * 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. + 2018-12-12 Iain Sandoe * config/rs6000/rs6000-protos.h (rs6000_call_darwin): New. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 5beb8dfe24a..a8e50cf1be3 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -23969,7 +23969,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; } @@ -23989,13 +23989,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; }