This fixes a failure in the testsuite. When we transform the doloop pattern, the decrement of the old iteration register goes away, which is a problem if it's used after the loop (where it should have the value zero).

Committed.


Bernd
	* config/c6x/c6x.c (predicate_insn): Avoid rtl sharing failure.
	(hwloop_optimize): Handle case where the old iteration reg is used
	after the loop.

Index: gcc/config/c6x/c6x.c
===================================================================
--- gcc/config/c6x/c6x.c	(revision 245685)
+++ gcc/config/c6x/c6x.c	(working copy)
@@ -5788,8 +5789,9 @@ hwloop_optimize (hwloop_info loop)
   start_sequence ();
 
   insn = emit_insn (gen_mvilc (loop->iter_reg));
+  if (loop->iter_reg_used_outside)
+    insn = emit_move_insn (loop->iter_reg, const0_rtx);
   insn = emit_insn (gen_sploop (GEN_INT (sp_ii)));
-
   seq = get_insns ();
 
   if (!single_succ_p (entry_bb) || vec_safe_length (loop->incoming) > 1)

Reply via email to