diff options
| author | krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-19 09:20:38 +0000 |
|---|---|---|
| committer | krebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-19 09:20:38 +0000 |
| commit | c2af6e1a7b48208356e8c49bf1be53a604f64253 (patch) | |
| tree | 44f6deac039397169aee62c4e73bc7e8299b03ed | |
| parent | bad814d759473ec4a1c0fde8463e6418f7e9c396 (diff) | |
| download | ppe42-gcc-c2af6e1a7b48208356e8c49bf1be53a604f64253.tar.gz ppe42-gcc-c2af6e1a7b48208356e8c49bf1be53a604f64253.zip | |
2014-09-19 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
PR target/62662
* config/s390/s390.c (s390_emit_epilogue): When doing the return
address load optimization force s390_optimize_prologue to leave it
that way. Only do the optimization if we already decided to push
r14 into a stack slot.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@215383 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/config/s390/s390.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index aac8de848ac..866de858cf0 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -9130,11 +9130,14 @@ s390_emit_epilogue (bool sibcall) if (! sibcall) { /* Fetch return address from stack before load multiple, - this will do good for scheduling. */ - - if (cfun_frame_layout.save_return_addr_p - || (cfun_frame_layout.first_restore_gpr < BASE_REGNUM - && cfun_frame_layout.last_restore_gpr > RETURN_REGNUM)) + this will do good for scheduling. + + Only do this if we already decided that r14 needs to be + saved to a stack slot. (And not just because r14 happens to + be in between two GPRs which need saving.) Otherwise it + would be difficult to take that decision back in + s390_optimize_prologue. */ + if (cfun_gpr_save_slot (RETURN_REGNUM) == -1) { int return_regnum = find_unused_clobbered_reg(); if (!return_regnum) @@ -9149,6 +9152,12 @@ s390_emit_epilogue (bool sibcall) addr = gen_rtx_MEM (Pmode, addr); set_mem_alias_set (addr, get_frame_alias_set ()); emit_move_insn (return_reg, addr); + + /* Once we did that optimization we have to make sure + s390_optimize_prologue does not try to remove the + store of r14 since we will not be able to find the + load issued here. */ + cfun_frame_layout.save_return_addr_p = true; } } |

