From c704706201e54b922001b86ecfd81df60772563f Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Fri, 9 Feb 2018 11:42:34 +0000 Subject: [PATCH] S/390: Fix PR84295 gcc/ChangeLog: 2018-02-09 Andreas Krebbel PR target/PR84295 * config/s390/s390.c (s390_set_current_function): Invoke s390_indirect_branch_settings also if fndecl didn't change. gcc/testsuite/ChangeLog: 2018-02-09 Andreas Krebbel PR target/PR84295 * gcc.target/s390/pr84295.c: New test. From-SVN: r257522 --- gcc/ChangeLog | 6 ++++++ gcc/config/s390/s390.c | 5 ++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/s390/pr84295.c | 14 ++++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/s390/pr84295.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fc3d80c3552..7a01d21026e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-02-09 Andreas Krebbel + + PR target/PR84295 + * config/s390/s390.c (s390_set_current_function): Invoke + s390_indirect_branch_settings also if fndecl didn't change. + 2018-02-09 Alexandre Oliva * config/rs6000/rs6000.md (blockage): Set length to zero. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 62a60e2c953..298fdd16490 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -16135,7 +16135,10 @@ s390_set_current_function (tree fndecl) several times in the course of compiling a function, and we don't want to slow things down too much or call target_reinit when it isn't safe. */ if (fndecl == s390_previous_fndecl) - return; + { + s390_indirect_branch_settings (fndecl); + return; + } tree old_tree; if (s390_previous_fndecl == NULL_TREE) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ff8136e2234..25c8afca21c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-09 Andreas Krebbel + + PR target/PR84295 + * gcc.target/s390/pr84295.c: New test. + 2018-02-09 Paolo Carlini PR c++/77522 diff --git a/gcc/testsuite/gcc.target/s390/pr84295.c b/gcc/testsuite/gcc.target/s390/pr84295.c new file mode 100644 index 00000000000..4da43c3cded --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr84295.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=z900 -fgnu89-inline --save-temps -mfunction-return-reg=thunk -mindirect-branch-table" } */ + +extern void foo (void); +extern __inline void foo (void) {} +void foo (void) {} + +/* { dg-final { scan-assembler-times "jg\t__s390_indirect_jump" 1 } } */ +/* { dg-final { scan-assembler "ex\t" } } */ + +/* { dg-final { scan-assembler-not "section\t.s390_indirect_jump" } } */ +/* { dg-final { scan-assembler-not "section\t.s390_indirect_call" } } */ +/* { dg-final { scan-assembler "section\t.s390_return_reg" } } */ +/* { dg-final { scan-assembler-not "section\t.s390_return_mem" } } */ -- 2.30.2