Patch to fix emit_insn_before
John Wehle
john@feith.com
Wed Jan 12 22:47:00 GMT 2000
> On Wed, Jan 12, 2000 at 02:27:01AM -0500, John Wehle wrote:
> > This patch fixes a problem which occurs when adding a sequence
> > to the beginning of a basic block. Currently the last insn of
> > the sequence is returned which causes problems when updating
> > the basic block head (it causes the other insns in the sequence
> > to be stranded between basic blocks).
>
> Who, exactly, is depending on this?
emit_block_insn_before, emit_swap_insn, scan_one_insn,
duplicate_loop_exit_test (emit_jump_insn_before calls emit_insn_before)
though it appears to assume that only one insn is emitted (based on
how reg_scan_update is used), and the code currently in insert_insn_end_bb.
I saw the failure on PA-RISC when compute_transp core dumped due to
bb = BLOCK_NUM (r->insn) referencing a NULL pointer while compiling
new1.cc. The problem was triggered by an unrelated change which
caused compute_bb_for_insn to be called after a sequence had
been added by insert_insn_end_bb to the beginning of a block. This
cleared the block information that insert_insn_end_bb had established
by calling set_block_num for each insn in the sequence.
For what it's worth (and I realize isn't a lot :-) The patch
passed bootstrap and check on powerpc, sparc, and x86 in addition
to preventing the failure on the PA-RISC. I haven't actually
completed a bootstrap and check on PA-RISC though it's in progress
(it takes a couple of days due to the machine being very slow).
> We've always returned
> the last insn of the sequence. Changing this would mean
> auditing all existing uses of emit_insn_before.
Many of the places appear to be concerned with only one insn. I
just looked again, and one of the places I'm not sure about is
check_dbra_loop. I do probably need to change
delete_null_pointer_checks_1 to do emit_barrier_before (last_insn)
instead of emit_barrier_after (new_jump).
I certainly understand your concern regarding this change and am
open to suggestions.
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------
More information about the Gcc-patches
mailing list