Hello Richard:
On 19/06/24 2:52 pm, Richard Sandiford wrote:
> Ajit Agarwal <[email protected]> writes:
>> On 19/06/24 2:40 pm, Richard Sandiford wrote:
>>> Ajit Agarwal <[email protected]> writes:
>>>> Hello Richard:
>>>>
>>>> On 19/06/24 1:54 pm, Richard Sandiford wrote:
>>>>> Ajit Agarwal <[email protected]> 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
>
Thanks.
This is the dump of use at assert point.
use of superceded set r178:i131 (V2DI pseudo) by insn i133 in bb2 [ebb2] at
point 180
defined in bb2 [ebb2] at point 108
This is the dump of change.
deletion of insn i130 in bb2 [ebb2] at point 106:
deleted
uses:
use of set r219:i291 (DI pseudo)
appears inside an address
superceded use of set mem:i114
defines:
set r177:i131 (OO pseudo)
used by insn i132 in bb2 [ebb2] at point 178
change to insn i131 in bb2 [ebb2] at point 108:
+--------------------------------------
| 131: r177:OO=unspec[[r219:DI]] 101
+--------------------------------------
uses:
superceded use of set r219:i291 (DI pseudo)
appears inside an address
superceded use of set mem:i114
defines:
superceded set r178:i131 (V2DI pseudo)
used by insn i133 in bb2 [ebb2] at point 180
~~~~~~~
new cost: 2147483647
new uses:
use of set r219:i291 (DI pseudo) by insn i131 in bb2 [ebb2] at point 108
defined in bb2 [ebb2] at point 62
appears inside an address
use of set mem:i114 by insn i131 in bb2 [ebb2] at point 108
defined in bb2 [ebb2] at point 104
new defs:
set r177:i131 (OO pseudo) in bb2 [ebb2] at point 108
used by insn i132 in bb2 [ebb2] at point 178
first insert-after candidate: insn i131 in bb2 [ebb2] at point 108
last insert-after candidate: insn i131 in bb2 [ebb2] at point 108
Thanks & Regards
Ajit
>
> 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)