diff options
author | Jeff Law <law@gcc.gnu.org> | 1997-12-06 17:31:01 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1997-12-06 17:31:01 -0700 |
commit | 956d69504d77d301015532d2f0564213f0efc706 (patch) | |
tree | ec80f8d1e46852ac1ba45aecdcda7201c302ac6f /gcc/loop.c | |
parent | 27b6b158c29b45fd80c2f104d5da1f4bc818d7ab (diff) | |
download | gcc-956d69504d77d301015532d2f0564213f0efc706.zip gcc-956d69504d77d301015532d2f0564213f0efc706.tar.gz gcc-956d69504d77d301015532d2f0564213f0efc706.tar.bz2 |
Merge from gcc-2.8
From-SVN: r16987
Diffstat (limited to 'gcc/loop.c')
-rw-r--r-- | gcc/loop.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -3633,11 +3633,20 @@ strength_reduce (scan_start, end, loop_top, insn_count, for (bl = loop_iv_list; bl; bl = bl->next) { rtx src; + rtx note; if (! bl->init_insn) continue; - src = SET_SRC (bl->init_set); + /* IF INIT_INSN has a REG_EQUAL or REG_EQUIV note and the value + is a constant, use the value of that. */ + if (((note = find_reg_note (bl->init_insn, REG_EQUAL, 0)) != NULL + && CONSTANT_P (XEXP (note, 0))) + || ((note = find_reg_note (bl->init_insn, REG_EQUIV, 0)) != NULL + && CONSTANT_P (XEXP (note, 0)))) + src = XEXP (note, 0); + else + src = SET_SRC (bl->init_set); if (loop_dump_stream) fprintf (loop_dump_stream, @@ -6185,8 +6194,8 @@ check_dbra_loop (loop_end, insn_count, loop_start) /* Now check other conditions: - The increment must be a constant and the comparison code - must be LT. + The increment must be a constant, as must the initial value, + and the comparison code must be LT. This test can probably be improved since +/- 1 in the constant can be obtained by changing LT to LE and vice versa; this is @@ -6195,7 +6204,8 @@ check_dbra_loop (loop_end, insn_count, loop_start) if (comparison && GET_CODE (XEXP (comparison, 1)) == CONST_INT /* LE gets turned into LT */ - && GET_CODE (comparison) == LT) + && GET_CODE (comparison) == LT + && GET_CODE (bl->initial_value) == CONST_INT) { HOST_WIDE_INT add_val, comparison_val; rtx initial_value; |