diff options
author | Michael Meissner <meissner@linux.vnet.ibm.com> | 2017-03-01 18:33:21 +0000 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 2017-03-01 18:33:21 +0000 |
commit | c7f0c9f34f82df40f1bff7662e64c9d5342b3585 (patch) | |
tree | 956bfe58267a1acc98b592348be48dcf5371667f | |
parent | f5ef6bfc3049187c0d84e12ed676b1b74207a693 (diff) | |
download | gcc-c7f0c9f34f82df40f1bff7662e64c9d5342b3585.zip gcc-c7f0c9f34f82df40f1bff7662e64c9d5342b3585.tar.gz gcc-c7f0c9f34f82df40f1bff7662e64c9d5342b3585.tar.bz2 |
re PR target/79439 (Missing nop instruction after recursive call corrupts TOC register)
[gcc]
2017-03-01 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/79439
* config/rs6000/predicates.md (current_file_function_operand): Do
not allow self calls to be local if the function is replaceable.
[gcc/testsuite]
2017-03-01 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/79439
* gcc.target/powerpc/pr79439.c: New test.
From-SVN: r245813
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/rs6000/predicates.md | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/powerpc/pr79439.c | 29 |
4 files changed, 42 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index febbf10..c4f8798 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-01 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR target/79439 + * config/rs6000/predicates.md (current_file_function_operand): Do + not allow self calls to be local if the function is replaceable. + 2017-03-01 Kelvin Nilsen <kelvin@gcc.gnu.org> PR target/79395 diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md index 43e7a1c..eb9321b 100644 --- a/gcc/config/rs6000/predicates.md +++ b/gcc/config/rs6000/predicates.md @@ -1110,7 +1110,8 @@ (and (match_code "symbol_ref") (match_test "(DEFAULT_ABI != ABI_AIX || SYMBOL_REF_FUNCTION_P (op)) && (SYMBOL_REF_LOCAL_P (op) - || op == XEXP (DECL_RTL (current_function_decl), 0)) + || (op == XEXP (DECL_RTL (current_function_decl), 0) + && !decl_replaceable_p (current_function_decl))) && !((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && (SYMBOL_REF_EXTERNAL_P (op) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 25b59da..b3ba66b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-01 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR target/79439 + * gcc.target/powerpc/pr79439.c: New test. + 2017-03-01 Pat Haugen <pthaugen@us.ibm.com> * gcc.target/powerpc/pr79544.c: Add test for vec_vsrad and fix up diff --git a/gcc/testsuite/gcc.target/powerpc/pr79439.c b/gcc/testsuite/gcc.target/powerpc/pr79439.c new file mode 100644 index 0000000..23c9a24 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr79439.c @@ -0,0 +1,29 @@ +/* { dg-do compile { target { powerpc64*-*-linux* && lp64 } } } */ +/* { dg-options "-O2 -fpic" } */ + +/* On the Linux 64-bit ABIs, we should not eliminate NOP in the 'rec' call if + -fpic is used because rec can be interposed at link time (since it is + external), and the recursive call should call the interposed function. The + Linux 32-bit ABIs do not require NOPs after the BL instruction. */ + +int f (void); + +void +g (void) +{ +} + +int +rec (int a) +{ + int ret = 0; + if (a > 10 && f ()) + ret += rec (a - 1); + g (); + return a + ret; +} + +/* { dg-final { scan-assembler-times {\mbl f\M} 1 } } */ +/* { dg-final { scan-assembler-times {\mbl g\M} 1 } } */ +/* { dg-final { scan-assembler-times {\mbl rec\M} 1 } } */ +/* { dg-final { scan-assembler-times {\mnop\M} 3 } } */ |