Blame SOURCES/gcc48-pr79439.patch

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