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