[Mesa-dev] [PATCH] i965/fs: Readd opt_drop_redundant_mov_to_flags().

Matt Turner mattst88 at gmail.com
Thu Apr 21 17:30:30 UTC 2016


On Thu, Apr 21, 2016 at 1:15 AM, Iago Toral <itoral at igalia.com> wrote:
> On Wed, 2016-04-20 at 14:22 -0700, Matt Turner wrote:
>> This reverts commit b449366587b5f3f64c6fb45fe22c39e4bc8a4309.
>>
>> I removed the pass thinking that it was now not useful, but that was not
>> true. I believe I ran shader-db on HSW and saw no results, but HSW does
>> not use the unlit centroid workaround code and as a result does not emit
>> redundant MOV_DISPATCH_TO_FLAGS instructions.
>
> I guess this means that dead-code-elimination doesn't really do anything
> about this as you initially thought, right?

Right, the sequence of instructions looks like

 mov_dispatch_to_flags(8) (null):UD,
 (-f0.0) linterp(8) vgrf66:F, g2:F, g4<0>:F
 (+f0.0) linterp(8) vgrf66:F, g4:F, g4<0>:F
-mov_dispatch_to_flags(8) (null):UD,
 (-f0.0) linterp(8) vgrf67:F, g2:F, g4<0>:F
 (+f0.0) linterp(8) vgrf67:F, g4:F, g4<0>:F
-mov_dispatch_to_flags(8) (null):UD,
 (-f0.0) linterp(8) vgrf68:F, g2:F, g5<0>:F
 (+f0.0) linterp(8) vgrf68:F, g4:F, g5<0>:F

And since the subsequent mov_dispatch_to_flags instructions write
results that are used, dead_code_eliminate won't remove them. However
we know they're dead because they write the same result as before.

I'm not sure which (more general) optimization should handle things
like that. I guess it's a special case because it's writing to a weird
register.


More information about the mesa-dev mailing list