[Mesa-dev] [PATCH] i965/vec4: Detect and delete useless MOVs.

Matt Turner mattst88 at gmail.com
Mon Sep 21 14:31:10 PDT 2015


On Mon, Sep 21, 2015 at 2:16 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Mon, Sep 21, 2015 at 2:04 PM, Matt Turner <mattst88 at gmail.com> wrote:
>> With NIR:
>>
>> instructions in affected programs:     111508 -> 109193 (-2.08%)
>> helped:                                507
>
> *sigh*  Any idea who's emitting these MOV's?  If it's vec_to_movs, we
> should probably fix it one of these days.  In any case,

No idea.

I found it by looking at a shader like
team-fortress-2/2200.shader_test -- which contains a series of no-op
moves inside an if/endif.

>> Without NIR:
>>
>> instructions in affected programs:     28763 -> 28474 (-1.00%)
>> helped:                                186
>> ---
>>  src/mesa/drivers/dri/i965/brw_vec4.cpp | 21 +++++++++++++++++++++
>>  1 file changed, 21 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
>> index ed49cd3..d09a8dd 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
>> @@ -1021,6 +1021,27 @@ vec4_visitor::opt_register_coalesce()
>>           inst->src[0].abs || inst->src[0].negate || inst->src[0].reladdr)
>>          continue;
>>
>
> Could we add a quick comment here that we're detecting a no-op MOV?

Sure. I added

      /* Remove no-op MOVs */

above the if statement.

> With that,
>
> Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

Thanks!


More information about the mesa-dev mailing list