]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
jump.c (jump_optimize_1): When we delete a conditional jump preceeding a non-conditio...
authorRichard Henderson <rth@redhat.com>
Wed, 14 Feb 2001 18:34:25 +0000 (10:34 -0800)
committerDJ Delorie <dj@gcc.gnu.org>
Wed, 14 Feb 2001 18:34:25 +0000 (13:34 -0500)
* 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

gcc/ChangeLog
gcc/jump.c

index 63bbb9bff3f4d7f8e503ef38274d7c7d118ac1f5..a97e22abc243d224a9299447a4eb28e17e5651f1 100644 (file)
@@ -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.
index 978b2666a0e05940ac1e299a1d0dbdc45d5ebb35..121375395bdfd047d0614143069e7e18db4c3de1 100644 (file)
@@ -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;