aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorGlen Nakamura <glen@imodulo.com>2003-03-27 18:53:36 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2003-03-27 18:53:36 +0000
commitc7d325c803cc4d985809b1b85572e0cd2c1cb5a1 (patch)
tree796445c9df0e9caa4b8e1dce2480c314d1c297fc /gcc/loop.c
parentf18ab43711810de62db708d3c643664344c96aef (diff)
downloadgcc-c7d325c803cc4d985809b1b85572e0cd2c1cb5a1.zip
gcc-c7d325c803cc4d985809b1b85572e0cd2c1cb5a1.tar.gz
gcc-c7d325c803cc4d985809b1b85572e0cd2c1cb5a1.tar.bz2
re PR rtl-optimization/10087 (optimizer produces wrong code when indexing 2D array)
PR opt/10087 * gcc.dg/20030324-1.c: New test. PR opt/10087 * loop.c (loop_givs_reduce): Skip bivs with duplicate locations while incrementing giv. (record_biv): Check for duplicate biv locations and set (struct induction *) v->same if found. From-SVN: r64928
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index 781ed37..7624b6d 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -4817,6 +4817,9 @@ loop_givs_reduce (loop, bl)
{
rtx insert_before;
+ /* Skip if location is the same as a previous one. */
+ if (tv->same)
+ continue;
if (! auto_inc_opt)
insert_before = NEXT_INSN (tv->insn);
else if (auto_inc_opt == 1)
@@ -5724,6 +5727,7 @@ record_biv (loop, v, insn, dest_reg, inc_val, mult_val, location,
v->always_computable = ! not_every_iteration;
v->always_executed = ! not_every_iteration;
v->maybe_multiple = maybe_multiple;
+ v->same = 0;
/* Add this to the reg's iv_class, creating a class
if this is the first incrementation of the reg. */
@@ -5761,6 +5765,17 @@ record_biv (loop, v, insn, dest_reg, inc_val, mult_val, location,
/* Put it in the array of biv register classes. */
REG_IV_CLASS (ivs, REGNO (dest_reg)) = bl;
}
+ else
+ {
+ /* Check if location is the same as a previous one. */
+ struct induction *induction;
+ for (induction = bl->biv; induction; induction = induction->next_iv)
+ if (location == induction->location)
+ {
+ v->same = induction;
+ break;
+ }
+ }
/* Update IV_CLASS entry for this biv. */
v->next_iv = bl->biv;