Blame SOURCES/gcc48-pr79439.patch

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