* gcse.c (cprop_jump): Delete insn if simplified jump is no-op.
authorJan Hubicka <jh@suse.cz>
Wed, 9 Jan 2002 21:49:02 +0000 (22:49 +0100)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 9 Jan 2002 21:49:02 +0000 (13:49 -0800)
From-SVN: r48694

gcc/ChangeLog
gcc/gcse.c

index 3b5deaa929a8a1b7d37af3859de747b0b5b9b7f5..6f13ad2f65b30da71353ceca81c3d115947df983 100644 (file)
@@ -1,3 +1,7 @@
+2002-01-09  Jan Hubicka  <jh@suse.cz>
+
+       * gcse.c (cprop_jump): Delete insn if simplified jump is no-op.
+
 2002-01-09  Richard Henderson  <rth@redhat.com>
 
        * config/arm/arm.c (arm_gen_constant): Use trunc_int_for_mode.
index e91b61a484574dedb33c544575adec4098adc0ea..e8361fc5aab6486341256af2c7fb1e6e0021f7d1 100644 (file)
@@ -4037,28 +4037,20 @@ cprop_jump (bb, insn, from, src)
   if (rtx_equal_p (new, SET_SRC (set)))
     return 0;
  
-  /* If this is now a no-op leave it that way, but update LABEL_NUSED if
-     necessary.  */
+  /* If this is now a no-op delete it, otherwise this must be a valid insn.  */
   if (new == pc_rtx)
+    delete_insn (insn);
+  else
     {
-      SET_SRC (set) = new;
-
-      if (JUMP_LABEL (insn) != 0)
-       {
-         --LABEL_NUSES (JUMP_LABEL (insn));
-         JUMP_LABEL (insn) = NULL_RTX;
-       }
-    }
-
-  /* Otherwise, this must be a valid instruction.  */
-  else if (! validate_change (insn, &SET_SRC (set), new, 0))
-    return 0;
+      if (! validate_change (insn, &SET_SRC (set), new, 0))
+       return 0;
 
-  /* If this has turned into an unconditional jump,
-     then put a barrier after it so that the unreachable
-     code will be deleted.  */
-  if (GET_CODE (SET_SRC (set)) == LABEL_REF)
-    emit_barrier_after (insn);
+      /* If this has turned into an unconditional jump,
+        then put a barrier after it so that the unreachable
+        code will be deleted.  */
+      if (GET_CODE (SET_SRC (set)) == LABEL_REF)
+       emit_barrier_after (insn);
+     }
 
   run_jump_opt_after_gcse = 1;