[RS6000] Correct save_reg_p
commit9b747072b98c6f8a0ffb058e89b45d36b47152cc
authorAlan Modra <amodra@gmail.com>
Fri, 8 Feb 2019 22:20:58 +0000 (9 08:50 +1030)
committerAlan Modra <amodra@gcc.gnu.org>
Fri, 8 Feb 2019 22:20:58 +0000 (9 08:50 +1030)
tree3e40cee7cbfd77fe6d27b5071742fb2117a8fa73
parentddf321918d35a4f737dda35867c550ab7daf8dfc
[RS6000] Correct save_reg_p

Fixes lack of r30 save/restore on

// -m32 -fpic -ftls-model=initial-exec
__thread char* p;
char** f1 (void) { return &p; }

and

// -m32 -fpic -msecure-plt
extern int foo (int);
int f1 (int x) { return foo (x); }

These are both caused by save_reg_p returning false when the pic
offset table reg (r30 for ABI_V4) was used, due to the logic not
exactly matching that in rs6000_emit_prologue to set up r30.

I also noticed that save_reg_p isn't following the comment regarding
calls_eh_return (since svn 267049, git 0edf78b1b2a0), and the comment
needs tweaking too.  For why the revised comment is correct, grep for
saves_all_registers in lra.c, and yes, we do want to save the pic
offset table reg for eh_return.

PR target/88343
* config/rs6000/rs6000.c (save_reg_p): Correct calls_eh_return
case.  Match logic in rs6000_emit_prologue emitting pic_offset_table
setup.

From-SVN: r268708
gcc/ChangeLog
gcc/config/rs6000/rs6000.c