]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/64876 (Regressions in gcc-testresults for powerpc64 gccgo in 5.0 due...
authorAlan Modra <amodra@gmail.com>
Thu, 5 Feb 2015 22:52:24 +0000 (09:22 +1030)
committerAlan Modra <amodra@gcc.gnu.org>
Thu, 5 Feb 2015 22:52:24 +0000 (09:22 +1030)
PR target/64876
* config/rs6000/rs6000.c (chain_already_loaded): New function.
(rs6000_call_aix): Use it.

From-SVN: r220463

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

index b4c14d1d1b6d26500d2ad707e3472f86f1278724..90cee313a262ddd5f998ecdc96512ee5caaba9eb 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-06  Alan Modra  <amodra@gmail.com>
+
+       PR target/64876
+       * config/rs6000/rs6000.c (chain_already_loaded): New function.
+       (rs6000_call_aix): Use it.
+
 2015-02-05  Jan Hubicka <hubicka@ucw.cz>
 
        * ipa-cp.c (ipa_value_from_jfunc, ipa_context_from_jfunc): Add bounds
index 356955ab8bbdb8c9225dd2773d94570425f882ef..4f88328a506351de8947affc744f498734039e60 100644 (file)
@@ -32919,6 +32919,28 @@ rs6000_legitimate_constant_p (machine_mode mode, rtx x)
 }
 
 \f
+/* Return TRUE iff the sequence ending in LAST sets the static chain.  */
+
+static bool
+chain_already_loaded (rtx_insn *last)
+{
+  for (; last != NULL; last = PREV_INSN (last))
+    {
+      if (NONJUMP_INSN_P (last))
+       {
+         rtx patt = PATTERN (last);
+
+         if (GET_CODE (patt) == SET)
+           {
+             rtx lhs = XEXP (patt, 0);
+
+             if (REG_P (lhs) && REGNO (lhs) == STATIC_CHAIN_REGNUM)
+               return true;
+           }
+       }
+    }
+  return false;
+}
 
 /* Expand code to perform a call under the AIX or ELFv2 ABI.  */
 
@@ -33002,7 +33024,9 @@ rs6000_call_aix (rtx value, rtx func_desc, rtx flag, rtx cookie)
             originally direct, the 3rd word has not been written since no
             trampoline has been built, so we ought not to load it, lest we
             override a static chain value.  */
-         if (!direct_call_p && TARGET_POINTERS_TO_NESTED_FUNCTIONS)
+         if (!direct_call_p
+             && TARGET_POINTERS_TO_NESTED_FUNCTIONS
+             && !chain_already_loaded (crtl->emit.sequence_stack->last))
            {
              rtx sc_reg = gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM);
              rtx func_sc_offset = GEN_INT (2 * GET_MODE_SIZE (Pmode));