]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[RS6000] Correct save_reg_p
authorAlan Modra <amodra@gmail.com>
Sat, 9 Feb 2019 12:44:02 +0000 (23:14 +1030)
committerAlan Modra <amodra@gcc.gnu.org>
Sat, 9 Feb 2019 12:44:02 +0000 (23:14 +1030)
PR target/88343
* config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Match
logic in rs6000_emit_prologue emitting pic_offset_table setup.

From-SVN: r268722

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index 91dbf9962adf1dccca8301755a8e0d03a5e8b277..9e73034f085b9a8fd806433fa918181a4e0cc878 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-09  Alan Modra  <amodra@gmail.com>
+
+       PR target/88343
+       * config/rs6000/rs6000.c (rs6000_reg_live_or_pic_offset_p): Match
+       logic in rs6000_emit_prologue emitting pic_offset_table setup.
+
 2019-02-08  Eric Botcazou  <ebotcazou@adacore.com>
 
        Backport from mainline
index 68dd95429fe683a7445e7857e540f2619a07514a..f31a8b83a7593330ac6e93e2d8f1f529c57797fa 100644 (file)
@@ -26726,27 +26726,35 @@ save_reg_p (int r)
 static bool
 rs6000_reg_live_or_pic_offset_p (int reg)
 {
-  /* We need to mark the PIC offset register live for the same conditions
-     as it is set up, or otherwise it won't be saved before we clobber it.  */
-
   if (reg == RS6000_PIC_OFFSET_TABLE_REGNUM && !TARGET_SINGLE_PIC_BASE)
     {
+      /* When calling eh_return, we must return true for all the cases
+        where conditional_register_usage marks the PIC offset reg
+        call used or fixed.  */
+      if (crtl->calls_eh_return
+         && ((DEFAULT_ABI == ABI_V4 && flag_pic)
+             || (DEFAULT_ABI == ABI_DARWIN && flag_pic)
+             || (TARGET_TOC && TARGET_MINIMAL_TOC)))
+       return true;
+
+      /* We need to mark the PIC offset register live for the same
+        conditions as it is set up in rs6000_emit_prologue, or
+        otherwise it won't be saved before we clobber it.  */
       if (TARGET_TOC && TARGET_MINIMAL_TOC
-         && (crtl->calls_eh_return
-             || df_regs_ever_live_p (reg)
-             || !constant_pool_empty_p ()))
+         && !constant_pool_empty_p ())
        return true;
 
-      if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_DARWIN)
-         && flag_pic)
+      if (DEFAULT_ABI == ABI_V4
+         && (flag_pic == 1 || (flag_pic && TARGET_SECURE_PLT))
+         && df_regs_ever_live_p (RS6000_PIC_OFFSET_TABLE_REGNUM))
        return true;
-    }
 
-  /* If the function calls eh_return, claim used all the registers that would
-     be checked for liveness otherwise.  */
+      if (DEFAULT_ABI == ABI_DARWIN
+         && flag_pic && crtl->uses_pic_offset_table)
+       return true;
+    }
 
-  return ((crtl->calls_eh_return || df_regs_ever_live_p (reg))
-         && !call_used_regs[reg]);
+  return !call_used_regs[reg] && df_regs_ever_live_p (reg);
 }
 
 /* Return the first fixed-point register that is required to be