* cse.c (cse_insn): Mostly remove first hunk of code which collapsed
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 May 2001 00:23:46 +0000 (00:23 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 May 2001 00:23:46 +0000 (00:23 +0000)
        a computed jump into an unconditional jump.
        In second hunk of code for collapsing computed and conditional jumps
        into unconditional jumps, reemit the jump in additional cases.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41953 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cse.c

index b133cce..41ca403 100644 (file)
@@ -5,6 +5,11 @@
 
 Thu May 10 14:45:44 2001  Jeffrey A Law  (law@cygnus.com)
 
+       * cse.c (cse_insn): Mostly remove first hunk of code which collapsed
+       a computed jump into an unconditional jump.
+       In second hunk of code for collapsing computed and conditional jumps
+       into unconditional jumps, reemit the jump in additional cases.
+
        * jump.c (jump_optimize_1): Do not wrap the new jump target
        inside a LABEL_REF; gen_jump will do that automatically.
 
index 8571653..f3978e4 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5518,31 +5518,17 @@ cse_insn (insn, libcall_insn)
             check for this separately here.  We will delete such an
             insn below.
 
-            Tablejump insns contain a USE of the table, so simply replacing
-            the operand with the constant won't match.  This is simply an
-            unconditional branch, however, and is therefore valid.  Just
-            insert the substitution here and we will delete and re-emit
-            the insn later.  */
-
+            For other cases such as a table jump or conditional jump
+            where we know the ultimate target, go ahead and replace the
+            operand.  While that may not make a valid insn, we will
+            reemit the jump below (and also insert any necessary
+            barriers).  */
          if (n_sets == 1 && dest == pc_rtx
              && (trial == pc_rtx
                  || (GET_CODE (trial) == LABEL_REF
                      && ! condjump_p (insn))))
            {
-             if (trial == pc_rtx)
-               {
-                 SET_SRC (sets[i].rtl) = trial;
-                 cse_jumps_altered = 1;
-                 break;
-               }
-
-             PATTERN (insn) = gen_jump (XEXP (trial, 0));
-             INSN_CODE (insn) = -1;
-
-             if (NEXT_INSN (insn) != 0
-                 && GET_CODE (NEXT_INSN (insn)) != BARRIER)
-               emit_barrier_after (insn);
-
+             SET_SRC (sets[i].rtl) = trial;
              cse_jumps_altered = 1;
              break;
            }
@@ -5804,13 +5790,17 @@ cse_insn (insn, libcall_insn)
        }
 
       /* If this SET is now setting PC to a label, we know it used to
-        be a conditional or computed branch.  So we see if we can follow
-        it.  If it was a computed branch, delete it and re-emit.  */
+        be a conditional or computed branch.  */
       else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF)
        {
-         /* If this is not in the format for a simple branch and
-            we are the only SET in it, re-emit it.  */
-         if (! simplejump_p (insn) && n_sets == 1)
+         /* We reemit the jump in as many cases as possible just in
+            case the form of an unconditional jump is significantly
+            different than a computed jump or conditional jump.
+
+            If this insn has multiple sets, then reemitting the
+            jump is nontrivial.  So instead we just force rerecognition
+            and hope for the best.  */
+         if (n_sets == 1)
            {
              rtx new = emit_jump_insn_before (gen_jump (XEXP (src, 0)), insn);
              JUMP_LABEL (new) = XEXP (src, 0);
@@ -5818,11 +5808,6 @@ cse_insn (insn, libcall_insn)
              insn = new;
            }
          else
-           /* Otherwise, force rerecognition, since it probably had
-              a different pattern before.
-              This shouldn't really be necessary, since whatever
-              changed the source value above should have done this.
-              Until the right place is found, might as well do this here.  */
            INSN_CODE (insn) = -1;
 
          never_reached_warning (insn);