From 72b0c616a5f06426c90bbf29eabd4f2492542833 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sun, 8 Feb 1998 14:12:00 +0000 Subject: [PATCH] Feb 8 14:56:03 1998 Richard Kenner Feb 8 14:56:03 1998 Richard Kenner * loop.c (strength_reduce): When placing increment for auto-inc case, do comparison in loop order. From-SVN: r17781 --- gcc/ChangeLog | 5 +++++ gcc/loop.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 68c777dcbb2..e27249ea867 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +Sun Feb 8 14:56:03 1998 Richard Kenner + + * loop.c (strength_reduce): When placing increment for auto-inc + case, do comparison in loop order. + Sun Feb 8 13:21:38 1998 John Carr * bitmap.c (bitmap_debug_file): HOST_PTR_PRINTF converts a pointer, diff --git a/gcc/loop.c b/gcc/loop.c index 6aa748561b4..bc6d4f7f553 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -4114,8 +4114,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;