From e6f6eb290d40a568aa3bf4d08e8db61900af9ad5 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Wed, 28 Jul 1993 10:50:26 -0700 Subject: [PATCH] (strength_reduce): Don't ignore a giv that depends on a reversed biv. From-SVN: r5025 --- gcc/loop.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/loop.c b/gcc/loop.c index 1d1c03abe67..d51fff7276f 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -3708,7 +3708,14 @@ strength_reduce (scan_start, end, loop_top, insn_count, /* If an insn is not to be strength reduced, then set its ignore flag, and clear all_reduced. */ - if (v->lifetime * threshold * benefit < insn_count) + /* A giv that depends on a reversed biv must be reduced if it is + used after the loop exit, otherwise, it would have the wrong + value after the loop exit. To make it simple, just reduce all + of such giv's whether or not we know they are used after the loop + exit. */ + + if (v->lifetime * threshold * benefit < insn_count + && ! bl->reversed) { if (loop_dump_stream) fprintf (loop_dump_stream, -- 2.30.2