[PATCH vkd3d 2/6] vkd3d-shader/hlsl: Do not delete the node in replace_node().

Zebediah Figura zfigura at codeweavers.com
Tue Nov 23 10:17:42 CST 2021


On 11/23/21 3:46 AM, Giovanni Mascellani wrote:
> Hi,
> 
> On 23/11/21 02:45, Zebediah Figura wrote:
>> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
>> ---
>>
>> This depends on 220151.
> 
> It also clashes with 220153, though it's easy to fix that.
> 
> I am not particularly opposed to this patch, but what is the reason? In
> most (if not all) cases, if you replace a node and don't remove it, it
> will eventually be removed by DCE, so the result is going to be the same
> in the end (maybe processing will be a little slower, but I don't think
> that's a big problem).
> 
Yes, although that requires you to run DCE afterwards. Which is extra 
work, that's not particularly necessary if you already know what needs 
to be deleted. It also means that if you're going to run an optimization 
pass in a loop you need to make sure there's a DCE pass in that loop.


> There are some cases in which it is necessary to immediately remove the
> replaced node, because otherwise optimization enters an infinite loop.
> Since you introduced replace_and_remove_node I guess you already
> discovered that the hard way! :-P
> 
> But are there cases in which it is necessary to _not_ remove the
> replaced node? Because if there aren't, I would just always remove it as
> it happens now, which seems to me the simplest solution.

Patches 3 and 4 in this series reuse the replaced node. It's not 
*necessary* to do that, but it works, and saves the trouble of 
allocating a new one. I'm not opposed if there's a consensus of "don't 
do that", though.



More information about the wine-devel mailing list