diff options
author | Mark Mitchell <mark@codesourcery.com> | 2001-04-21 18:45:00 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2001-04-21 18:45:00 +0000 |
commit | e8c8470b1cfdb6d9abebf7e976317abeb8956c40 (patch) | |
tree | a75bbca9f3fbc9da9d02fb12d35775b6d16bb725 | |
parent | 51f26c450beaa99fc55f62cfb365fb3d7ce07080 (diff) | |
download | gcc-e8c8470b1cfdb6d9abebf7e976317abeb8956c40.zip gcc-e8c8470b1cfdb6d9abebf7e976317abeb8956c40.tar.gz gcc-e8c8470b1cfdb6d9abebf7e976317abeb8956c40.tar.bz2 |
flow.c (proagate_one_insn): Remove useless assignment.
* flow.c (proagate_one_insn): Remove useless assignment.
* jump.c (delete_insn): Tidy.
* loop.c (try_copy_prop): When deleting an instruction with a
REG_RETVAL note, delete the entire libcall sequence.
(loop_delete_insns): New function.
* unroll.c (initial_reg_note_copy): Copy INSN_LIST notes, even if
we're not substituting into them yet.
From-SVN: r41486
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/flow.c | 5 | ||||
-rw-r--r-- | gcc/jump.c | 7 | ||||
-rw-r--r-- | gcc/loop.c | 45 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/20010421-1.c | 8 | ||||
-rw-r--r-- | gcc/unroll.c | 2 |
6 files changed, 63 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 45493ea..f829983 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2001-04-21 Mark Mitchell <mark@codesourcery.com> + + * flow.c (proagate_one_insn): Remove useless assignment. + * jump.c (delete_insn): Tidy. + * loop.c (try_copy_prop): When deleting an instruction with a + REG_RETVAL note, delete the entire libcall sequence. + (loop_delete_insns): New function. + * unroll.c (initial_reg_note_copy): Copy INSN_LIST notes, even if + we're not substituting into them yet. + 2001-04-21 Kazu Hirata <kazu@hxi.com> * config/h8300/h8300.c (general_operand_src): Fix a comment typo. @@ -3734,10 +3734,7 @@ propagate_one_insn (pbi, insn) pbi->cc0_live = 0; if (libcall_is_dead) - { - prev = propagate_block_delete_libcall (pbi->bb, insn, note); - insn = NEXT_INSN (prev); - } + prev = propagate_block_delete_libcall (pbi->bb, insn, note); else propagate_block_delete_insn (pbi->bb, insn); @@ -2823,16 +2823,15 @@ delete_insn (insn) to special NOTEs instead. When not optimizing, leave them alone. */ if (was_code_label && LABEL_NAME (insn) != 0) { - if (! optimize) - dont_really_delete = 1; - else if (! dont_really_delete) + if (optimize) { const char *name = LABEL_NAME (insn); PUT_CODE (insn, NOTE); NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED_LABEL; NOTE_SOURCE_FILE (insn) = name; - dont_really_delete = 1; } + + dont_really_delete = 1; } else /* Mark this insn as deleted. */ @@ -9240,17 +9240,52 @@ try_copy_prop (loop, replacement, regno) fprintf (loop_dump_stream, " Replaced reg %d", regno); if (store_is_first && replaced_last) { - PUT_CODE (init_insn, NOTE); - NOTE_LINE_NUMBER (init_insn) = NOTE_INSN_DELETED; - if (loop_dump_stream) - fprintf (loop_dump_stream, ", deleting init_insn (%d)", - INSN_UID (init_insn)); + rtx first; + rtx retval_note; + + /* Assume we're just deleting INIT_INSN. */ + first = init_insn; + /* Look for REG_RETVAL note. If we're deleting the end of + the libcall sequence, the whole sequence can go. */ + retval_note = find_reg_note (init_insn, REG_RETVAL, NULL_RTX); + /* If we found a REG_RETVAL note, find the first instruction + in the sequence. */ + if (retval_note) + first = XEXP (retval_note, 0); + + /* Delete the instructions. */ + loop_delete_insns (first, init_insn); } if (loop_dump_stream) fprintf (loop_dump_stream, ".\n"); } } +/* Replace all the instructions from FIRST up to and including LAST + with NOTE_INSN_DELETED notes. */ + +static void +loop_delete_insns (first, last) + rtx first; + rtx last; +{ + while (1) + { + PUT_CODE (first, NOTE); + NOTE_LINE_NUMBER (first) = NOTE_INSN_DELETED; + if (loop_dump_stream) + fprintf (loop_dump_stream, ", deleting init_insn (%d)", + INSN_UID (first)); + + /* If this was the LAST instructions we're supposed to delete, + we're done. */ + if (first == last) + break; + + first = NEXT_INSN (first); + } +} + /* Try to replace occurrences of pseudo REGNO with REPLACEMENT within loop LOOP if the order of the sets of these registers can be swapped. There must be exactly one insn within the loop that sets diff --git a/gcc/testsuite/gcc.c-torture/compile/20010421-1.c b/gcc/testsuite/gcc.c-torture/compile/20010421-1.c new file mode 100644 index 0000000..bec6aa9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20010421-1.c @@ -0,0 +1,8 @@ +int j; + +void residual () +{ + long double s; + for (j = 3; j < 9; j++) + s -= 3; +} diff --git a/gcc/unroll.c b/gcc/unroll.c index 52de499..a0ffa95 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -1672,7 +1672,7 @@ initial_reg_note_copy (notes, map) XEXP (copy, 0) = copy_rtx_and_substitute (XEXP (notes, 0), map, 0); else if (GET_CODE (notes) == INSN_LIST) /* Don't substitute for these yet. */ - XEXP (copy, 0) = XEXP (notes, 0); + XEXP (copy, 0) = copy_rtx (XEXP (notes, 0)); else abort (); |