Blame SOURCES/gcc48-pr79439.patch

25c7f1
2017-03-01  Michael Meissner  <meissner@linux.vnet.ibm.com>
25c7f1
25c7f1
	PR target/79439
25c7f1
	* config/rs6000/predicates.md (current_file_function_operand): Do
25c7f1
	not allow self calls to be local if the function is replaceable.
25c7f1
25c7f1
	* gcc.target/powerpc/pr79439.c: New test.
25c7f1
25c7f1
--- gcc/config/rs6000/predicates.md	(revision 245812)
25c7f1
+++ gcc/config/rs6000/predicates.md	(revision 245813)
25c7f1
@@ -1086,8 +1086,8 @@
25c7f1
 			 && ((DEFAULT_ABI != ABI_AIX
25c7f1
 			      && DEFAULT_ABI != ABI_ELFv2)
25c7f1
 			     || !SYMBOL_REF_EXTERNAL_P (op)))
25c7f1
-		        || (op == XEXP (DECL_RTL (current_function_decl),
25c7f1
-						  0)))")))
25c7f1
+		        || (op == XEXP (DECL_RTL (current_function_decl), 0)
25c7f1
+			    && !decl_replaceable_p (current_function_decl)))")))
25c7f1
 
25c7f1
 ;; Return 1 if this operand is a valid input for a move insn.
25c7f1
 (define_predicate "input_operand"
25c7f1
--- gcc/testsuite/gcc.target/powerpc/pr79439.c	(nonexistent)
25c7f1
+++ gcc/testsuite/gcc.target/powerpc/pr79439.c	(revision 245813)
25c7f1
@@ -0,0 +1,29 @@
25c7f1
+/* { dg-do compile { target { powerpc64*-*-linux* && lp64 } } } */
25c7f1
+/* { dg-options "-O2 -fpic" } */
25c7f1
+
25c7f1
+/* On the Linux 64-bit ABIs, we should not eliminate NOP in the 'rec' call if
25c7f1
+   -fpic is used because rec can be interposed at link time (since it is
25c7f1
+   external), and the recursive call should call the interposed function.  The
25c7f1
+   Linux 32-bit ABIs do not require NOPs after the BL instruction.  */
25c7f1
+
25c7f1
+int f (void);
25c7f1
+
25c7f1
+void
25c7f1
+g (void)
25c7f1
+{
25c7f1
+}
25c7f1
+
25c7f1
+int
25c7f1
+rec (int a)
25c7f1
+{
25c7f1
+  int ret = 0;
25c7f1
+  if (a > 10 && f ())
25c7f1
+    ret += rec (a - 1);
25c7f1
+  g ();
25c7f1
+  return a + ret;
25c7f1
+}
25c7f1
+
25c7f1
+/* { dg-final { scan-assembler-times {\mbl f\M}   1 } } */
25c7f1
+/* { dg-final { scan-assembler-times {\mbl g\M}   2 } } */
25c7f1
+/* { dg-final { scan-assembler-times {\mbl rec\M} 1 } } */
25c7f1
+/* { dg-final { scan-assembler-times {\mnop\M}    4 } } */