From d785152f1ef2ee51d7b6af4cdaa479156c8ae138 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sun, 8 Feb 1998 22:59:47 +0000 Subject: [PATCH] loop.c (strength_reduce): When placing increment for auto-inc case, do comparison in loop order. * loop.c (strength_reduce): When placing increment for auto-inc case, do comparison in loop order. From-SVN: r17786 --- gcc/ChangeLog | 5 +++++ gcc/loop.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ebaff2d7969a..332025bdbc7a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 9 00:01:00 1998 Richard Kenner + + * loop.c (strength_reduce): When placing increment for auto-inc + case, do comparison in loop order. + Fri Jan 2 23:40:09 1998 Jim Wilson (wilson@cygnus.com) Jeffrey A Law (law@cygnus.com) diff --git a/gcc/loop.c b/gcc/loop.c index 4bd965d49a55..71cfebd260f0 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -4068,8 +4068,14 @@ strength_reduce (scan_start, end, loop_top, insn_count, auto_inc_opt = 1; } /* Check for case where increment is before the the address - giv. */ - else if (INSN_LUID (v->insn) > INSN_LUID (bl->biv->insn)) + giv. Do this test in "loop order". */ + else if ((INSN_LUID (v->insn) > INSN_LUID (bl->biv->insn) + && (INSN_LUID (v->insn) < INSN_LUID (scan_start) + || (INSN_LUID (bl->biv->insn) + > INSN_LUID (scan_start)))) + || (INSN_LUID (v->insn) < INSN_LUID (scan_start) + && (INSN_LUID (scan_start) + < INSN_LUID (bl->biv->insn)))) auto_inc_opt = -1; else auto_inc_opt = 1; -- 2.47.2