summaryrefslogtreecommitdiff
path: root/gcc/jump.c
diff options
context:
space:
mode:
authordj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2001-02-14 18:34:25 +0000
committerdj <dj@138bc75d-0d04-0410-961f-82ee72b054a4>2001-02-14 18:34:25 +0000
commit478f181c05d228c2ee8a83743c6cdba8012f0d5c (patch)
tree94760e35379c8c6c0c88a32dbc7d989737bb1970 /gcc/jump.c
parent3bc77e77b4557c79b0e2df9927c528c0bf4063e0 (diff)
downloadgcc-478f181c05d228c2ee8a83743c6cdba8012f0d5c.tar.gz
* jump.c (jump_optimize_1): When we delete a conditional jump
preceeding a non-conditional jump to effectively the same place, make sure that the combined jump skips any clobber insns between the two labels. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39686 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/jump.c')
-rw-r--r--gcc/jump.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/jump.c b/gcc/jump.c
index 978b2666a0e..121375395bd 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -420,6 +420,28 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan,
if (temp2 == temp)
{
+ /* Ensure that we jump to the later of the two labels.
+ Consider:
+
+ if (test) goto L2;
+ goto L1;
+ ...
+ L1:
+ (clobber return-reg)
+ L2:
+ (use return-reg)
+
+ If we leave the goto L1, we'll incorrectly leave
+ return-reg dead for TEST true. */
+
+ temp2 = next_active_insn (JUMP_LABEL (insn));
+ if (!temp2)
+ temp2 = get_last_insn ();
+ if (GET_CODE (temp2) != CODE_LABEL)
+ temp2 = prev_label (temp2);
+ if (temp2 != JUMP_LABEL (temp))
+ redirect_jump (temp, temp2, 1);
+
delete_jump (insn);
changed = 1;
continue;