c6x.c (hwloop_optimize): Handle case where the old iteration reg is used after the...
authorBernd Schmidt <bernds@redhat.com>
Wed, 15 Mar 2017 13:36:50 +0000 (13:36 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Wed, 15 Mar 2017 13:36:50 +0000 (13:36 +0000)
* config/c6x/c6x.c (hwloop_optimize): Handle case where the old
iteration reg is used after the loop.

From-SVN: r246160

gcc/ChangeLog
gcc/config/c6x/c6x.c

index d9f1054..eacca23 100644 (file)
@@ -1,3 +1,8 @@
+2017-03-15  Bernd Schmidt  <bschmidt@redhat.com>
+
+       * config/c6x/c6x.c (hwloop_optimize): Handle case where the old
+       iteration reg is used after the loop.
+
 2017-03-14  Martin Sebor  <msebor@redhat.com>
 
        PR tree-optimization/79800
index c54d4d1..4529fd4 100644 (file)
@@ -5789,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)