From 6c194efb233f17da1d6971121dcb2f86a671f946 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Wed, 15 Mar 2017 13:36:50 +0000 Subject: [PATCH] c6x.c (hwloop_optimize): Handle case where the old iteration reg is used after the loop. * config/c6x/c6x.c (hwloop_optimize): Handle case where the old iteration reg is used after the loop. From-SVN: r246160 --- gcc/ChangeLog | 5 +++++ gcc/config/c6x/c6x.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d9f1054b..eacca23 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-03-15 Bernd Schmidt + + * config/c6x/c6x.c (hwloop_optimize): Handle case where the old + iteration reg is used after the loop. + 2017-03-14 Martin Sebor PR tree-optimization/79800 diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c index c54d4d1..4529fd4 100644 --- a/gcc/config/c6x/c6x.c +++ b/gcc/config/c6x/c6x.c @@ -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) -- 2.7.4