aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2001-02-14 10:34:25 -0800
committerDJ Delorie <dj@gcc.gnu.org>2001-02-14 13:34:25 -0500
commit8e0b124eafae477ce0e3d8efc891dadd95038b71 (patch)
tree94760e35379c8c6c0c88a32dbc7d989737bb1970
parent7161c1a582aef9f05caeb12189391a9c04aadda9 (diff)
downloadgcc-8e0b124eafae477ce0e3d8efc891dadd95038b71.zip
gcc-8e0b124eafae477ce0e3d8efc891dadd95038b71.tar.gz
gcc-8e0b124eafae477ce0e3d8efc891dadd95038b71.tar.bz2
jump.c (jump_optimize_1): When we delete a conditional jump preceeding a non-conditional jump to...
* 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. Co-Authored-By: DJ Delorie <dj@redhat.com> From-SVN: r39686
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/jump.c22
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 63bbb9b..a97e22a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2001-02-14 Richard Henderson <rth@redhat.com>
+ DJ Delorie <dj@redhat.com>
+
+ * 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.
+
2001-02-14 Jeffrey Oldham <oldham@codesourcery.com>
* gcc.c (do_spec_1): Fix off-by-one error for '%M' case.
diff --git a/gcc/jump.c b/gcc/jump.c
index 978b2666..1213753 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;