* This patch, originally from Richard Kenner, fixes the 'root' of the optimization problem found in JUMP/CSE * loop.c (strength_reduce): When placing increment for auto-inc case, do comparison in loop order. --- egcs-1.0/gcc/loop.c.orig Sat Nov 8 00:36:51 1997 +++ egcs-1.0/gcc/loop.c Sun Feb 8 07:43:50 1998 @@ -4068,8 +4068,14 @@ 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;