+Tue Jul 31 15:33:27 CEST 2001 Jan Hubicka <jh@suse.cz>
+
+ * jump.c (duplicate_loop_exit_test): Better test for jumps
+ entering the loop; create loop pre_header.
+
2001-07-31 Hartmut Penner <hpenner@de.ibm.com>
* doc/install.texi: Add s390 and s390x as new targets.
rtx lastexit;
int max_reg = max_reg_num ();
rtx *reg_map = 0;
+ rtx loop_pre_header_label;
/* Scan the exit code. We do not perform this optimization if any insn:
reg_map[REGNO (reg)] = gen_reg_rtx (GET_MODE (reg));
}
}
+ loop_pre_header_label = gen_label_rtx ();
/* Now copy each insn. */
for (insn = exitcode; insn != lastexit; insn = NEXT_INSN (insn))
/* The jump_insn after loop_start should be followed
by barrier and loopback label. */
if (prev_nonnote_insn (label)
- && (PREV_INSN (prev_nonnote_insn (label))
- == NEXT_INSN (loop_start)))
- predict_insn_def (copy, PRED_LOOP_HEADER, TAKEN);
+ && (prev_nonnote_insn (prev_nonnote_insn (label))
+ == next_nonnote_insn (loop_start)))
+ {
+ predict_insn_def (copy, PRED_LOOP_HEADER, TAKEN);
+ /* To keep pre-header, we need to redirect all loop
+ entrances before the LOOP_BEG note. */
+ redirect_jump (copy, loop_pre_header_label, 0);
+ }
else
predict_insn_def (copy, PRED_LOOP_HEADER, NOT_TAKEN);
}
emit_barrier_before (loop_start);
}
+ emit_label_before (loop_pre_header_label, loop_start);
+
/* Now scan from the first insn we copied to the last insn we copied
(copy) for new pseudo registers. Do this after the code to jump to
the end label since that might create a new pseudo too. */