Ajit Agarwal <aagar...@linux.ibm.com> writes: > On 19/06/24 2:40 pm, Richard Sandiford wrote: >> Ajit Agarwal <aagar...@linux.ibm.com> writes: >>> Hello Richard: >>> >>> On 19/06/24 1:54 pm, Richard Sandiford wrote: >>>> Ajit Agarwal <aagar...@linux.ibm.com> writes: >>>>>> What happens if you leave the assert alone? When does it fire? Is it >>>>>> still for uses in debug insns? If so, it's the fusion pass's >>>>>> responsibility >>>>>> to update those, as mentioned above. And it must update them before, >>>>>> or at the same time as, it deletes the definition. >>>>>> >>>>> >>>>> For debug insn I call reset_debug_use and now I dont see issues >>>>> with debug insn and issues I see with non debug insn where >>>>> def is there in old_defs and use has to be removed for the insn >>>>> that we modify load with OO UNSPEC to generate lxvp. >>>> >>>> Can you walk me through it step-by-step? If you leave the assert >>>> alone, when does it fire? What set of insn_changes are being made >>>> when the assert fires? (Calling debug on the changes will show this.) >>>> And what use does the assert fire on? (Again, calling debug on the use >>>> will show this.) >>>> >>> >>> (insn 660 735 739 50 (set (reg:OO 405 [ MEM[(_Float128 *)src_196] ]) >>> (unspec:OO [ >>> (mem:OO (reg/v/f:DI 197 [ base ]) [9 MEM[(_Float128 >>> *)src_196]+0 S16 A128]) >>> ] UNSPEC_LXVP)) 2188 {*movoo1} >>> (nil)) >>> >>> This is definition. >>> >>> (insn 661 659 662 50 (set (reg:TF 179 [ result$imag ]) >>> (plus:TF (reg:TF 179 [ result$imag ]) >>> (subreg:TF (reg:OO 405 [ MEM[(_Float128 *)src_196] ]) 0))) >>> {addtf3} >>> >>> This is use. >>> >>> change has the above definition and the assert fires at the >>> above use. >> >> But can you call debug on the insn_change that contains the deleted def, >> and call debug on the access_info that triggers the assert? >> > > I am afraid I am not getting what exactly you meant here.
One way would be to apply a patch like the below and quote the output from the last "Changes:" onward. Richard diff --git a/gcc/rtl-ssa/changes.cc b/gcc/rtl-ssa/changes.cc index 11639e81bb7..694760138bb 100644 --- a/gcc/rtl-ssa/changes.cc +++ b/gcc/rtl-ssa/changes.cc @@ -249,6 +249,8 @@ function_info::process_uses_of_deleted_def (set_info *set) } else { + if (!use->is_live_out_use ()) + debug (use); gcc_assert (use->is_live_out_use ()); remove_use (use); } @@ -830,6 +832,9 @@ function_info::change_insns (array_slice<insn_change *> changes) // // In particular, this means that consumers must handle debug // instructions before removing a set. + fprintf (stderr, "Changes:\n"); + for (insn_change *change : changes) + debug (*change); for (insn_change *change : changes) for (def_info *def : change->old_defs ()) if (def->m_has_been_superceded)