]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/79439 (Missing nop instruction after recursive call corrupts...
authorMichael Meissner <meissner@linux.vnet.ibm.com>
Fri, 10 Mar 2017 20:53:18 +0000 (20:53 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Fri, 10 Mar 2017 20:53:18 +0000 (20:53 +0000)
[gcc]
2017-03-10  Michael Meissner  <meissner@linux.vnet.ibm.com>

Back port from trunk
2017-03-01  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/79439
* config/rs6000/predicates.md (current_file_function_operand): Do
not allow self calls to be local if the function is replaceable.

[gcc/testsuite]
2017-03-10  Michael Meissner  <meissner@linux.vnet.ibm.com>

Back port from trunk
2017-03-01  Michael Meissner  <meissner@linux.vnet.ibm.com>

PR target/79439
* gcc.target/powerpc/pr79439.c: New test.

From-SVN: r246058

gcc/ChangeLog
gcc/config/rs6000/predicates.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/powerpc/pr79439.c [new file with mode: 0644]

index 820965b6f68653ec98f9387b001d51ca792c2d52..e7c87c4b9d02b38c73475fd26453a7cada30a1fe 100644 (file)
@@ -1,3 +1,12 @@
+2017-03-10  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       Back port from trunk
+       2017-03-01  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/79439
+       * config/rs6000/predicates.md (current_file_function_operand): Do
+       not allow self calls to be local if the function is replaceable.
+
 2017-03-07  Uros Bizjak  <ubizjak@gmail.com>
 
        Backport from mainline
index 978ed9ba1eb0a4751ff08b8fe2157d8c5c485ac9..33fbd46984b263f27e495d5104198ec076902d43 100644 (file)
   (and (match_code "symbol_ref")
        (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op))
                    && (SYMBOL_REF_LOCAL_P (op)
-                       || op == XEXP (DECL_RTL (current_function_decl), 0))
+                       || (op == XEXP (DECL_RTL (current_function_decl), 0)
+                           && !decl_replaceable_p (current_function_decl)))
                    && !((DEFAULT_ABI == ABI_AIX
                          || DEFAULT_ABI == ABI_ELFv2)
                         && (SYMBOL_REF_EXTERNAL_P (op)
index fee2c8cd5a8003b53583886450ea2f69c89fe137..684c841f073efbd152a6798619b9f8e6dd88ab0b 100644 (file)
@@ -1,3 +1,11 @@
+2017-03-10  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       Back port from trunk
+       2017-03-01  Michael Meissner  <meissner@linux.vnet.ibm.com>
+
+       PR target/79439
+       * gcc.target/powerpc/pr79439.c: New test.
+
 2017-03-02  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/79514
diff --git a/gcc/testsuite/gcc.target/powerpc/pr79439.c b/gcc/testsuite/gcc.target/powerpc/pr79439.c
new file mode 100644 (file)
index 0000000..c9b9987
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-do compile { target { powerpc64*-*-linux* && lp64 } } } */
+/* { dg-options "-O2 -fpic" } */
+
+/* On the Linux 64-bit ABIs, we should not eliminate NOP in the 'rec' call if
+   -fpic is used because rec can be interposed at link time (since it is
+   external), and the recursive call should call the interposed function.  The
+   Linux 32-bit ABIs do not require NOPs after the BL instruction.  */
+
+int f (void);
+
+void
+g (void)
+{
+}
+
+int
+rec (int a)
+{
+  int ret = 0;
+  if (a > 10 && f ())
+    ret += rec (a - 1);
+  g ();
+  return a + ret;
+}
+
+/* { dg-final { scan-assembler-times {\mbl f\M}   1 } } */
+/* { dg-final { scan-assembler-times {\mbl g\M}   2 } } */
+/* { dg-final { scan-assembler-times {\mbl rec\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mnop\M}    4 } } */