Comments

Hello,
emit-rtl.c:remove_insn calls df_insn_delete on insns that have not
been emitted to the insn chain, and therefore don't have DF cache
entries yet. I think it's wrong for remove_insn to call
df_insn_delete.
delete_insn should be used to completely destroy an insn and all
associated data including DF caches. Calling remove_insn to really
delete an insn is also wrong because LABEL_NUSES isn't updated.
Fortunately, almost all code already uses delete_insn so this patch is
small.
remove_insn should only unlink an insn from the current insns chain
(the function body or an open start_sequence chain).
The attached patch makes it so... In fact, without this patch,
sel-sched-ir.c had to work around this problem (remove_insn doing
df_insn_delete) but it was leaking DF caches as a result. Probably
there are other places that can be simplified now to use remove_insn
instead of hacking the insn chain by hand. I've looked at all
remove_insn and delete_insn callers to make sure this patch does
In general I think it's wrong for emit-rtl to have any dependence on
DF (DF depends on RTL, but not the other way around) but that's not
something I want to work on right now.
Bootstrapped&tested on x86_64-unknown-linux-gnu. OK?
Ciao!
Steven
* emit-rtl.c (remove_insn): Do not call df_insn_delete here.
* cfgrtl.c (delete_insn): Call it here instead.
* lra-spills.c (lra_final_code_change): Use delete_insn.
* haifa-sched.c (sched_remove_insn): Likewise.
* sel-sched-ir.c (return_nop_to_pool): Clear INSN_DELETED_P for nops
returning to the nop pool.
(sel_remove_insn): Simplify the only_disconnect case via remove_insn,
use delete_insn for definitive removal. Clear BLOCK_FOR_INSN.