Simplification within reorg.c
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 5 Sep 2014 15:03:12 +0000 (15:03 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Fri, 5 Sep 2014 15:03:12 +0000 (15:03 +0000)
gcc/ChangeLog:
2014-09-05  David Malcolm  <dmalcolm@redhat.com>

* reorg.c (relax_delay_slots): Move declaration of "trial_seq"
above the conditional, and convert the check on GET_CODE to a
dyn_cast, so that "trial_seq" is available as an rtx_sequence * in
the conditional.  Simplify the conditional by using methods of
"trial_seq".

From-SVN: r214969

gcc/ChangeLog
gcc/reorg.c

index e0eca46..1929990 100644 (file)
@@ -1,5 +1,13 @@
 2014-09-05  David Malcolm  <dmalcolm@redhat.com>
 
+       * reorg.c (relax_delay_slots): Move declaration of "trial_seq"
+       above the conditional, and convert the check on GET_CODE to a
+       dyn_cast, so that "trial_seq" is available as an rtx_sequence * in
+       the conditional.  Simplify the conditional by using methods of
+       "trial_seq".
+
+2014-09-05  David Malcolm  <dmalcolm@redhat.com>
+
        * haifa-sched.c (check_clobbered_conditions): Strengthen local
        "link" from rtx to rtx_insn_list *, and use its methods for
        clarity and type-safety.
index 89d500d..7bacc6d 100644 (file)
@@ -3385,13 +3385,14 @@ relax_delay_slots (rtx_insn *first)
 
       /* Similarly, if it is an unconditional jump with one insn in its
         delay list and that insn is redundant, thread the jump.  */
-      if (trial && GET_CODE (PATTERN (trial)) == SEQUENCE
-         && XVECLEN (PATTERN (trial), 0) == 2
-         && JUMP_P (XVECEXP (PATTERN (trial), 0, 0))
-         && simplejump_or_return_p (XVECEXP (PATTERN (trial), 0, 0))
-         && redundant_insn (XVECEXP (PATTERN (trial), 0, 1), insn, 0))
+      rtx_sequence *trial_seq =
+       trial ? dyn_cast <rtx_sequence *> (PATTERN (trial)) : NULL;
+      if (trial_seq
+         && trial_seq->len () == 2
+         && JUMP_P (trial_seq->insn (0))
+         && simplejump_or_return_p (trial_seq->insn (0))
+         && redundant_insn (trial_seq->insn (1), insn, 0))
        {
-         rtx_sequence *trial_seq = as_a <rtx_sequence *> (PATTERN (trial));
          target_label = JUMP_LABEL (trial_seq->insn (0));
          if (ANY_RETURN_P (target_label))
            target_label = find_end_label (target_label);