Blame SOURCES/gcc48-pr79439.patch

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