diff options
author | Andreas Krebbel <Andreas.Krebbel@de.ibm.com> | 2014-09-19 09:14:59 +0000 |
---|---|---|
committer | Andreas Krebbel <krebbel@gcc.gnu.org> | 2014-09-19 09:14:59 +0000 |
commit | db716bdeca770228efaa5fb807079ff22e5e356b (patch) | |
tree | 8de291d8052bb6e067402faf7288083b41b64ae3 | |
parent | f434eb6997a825387bc5c068b0bd812c04c8e0d8 (diff) | |
download | gcc-db716bdeca770228efaa5fb807079ff22e5e356b.zip gcc-db716bdeca770228efaa5fb807079ff22e5e356b.tar.gz gcc-db716bdeca770228efaa5fb807079ff22e5e356b.tar.bz2 |
re PR target/62662 (Miscompilation of Qt on s390x)
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.
From-SVN: r215381
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/config/s390/s390.c | 20 |
2 files changed, 23 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ecfb1a6..f9a32f6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +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. + 2014-09-19 Marat Zakirov <m.zakirov@samsung.com> * asan.c (build_check_stmt): Alignment arg was added. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 0997fb6..481cd44 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -9083,11 +9083,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) @@ -9102,6 +9105,13 @@ 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; + cfun_gpr_save_slot (RETURN_REGNUM) = -1; } } |