[Mesa-dev] [PATCH 03/13] i965/register_coalesce: Do register size checks before is_copy_payload

Jason Ekstrand jason at jlekstrand.net
Tue May 5 12:28:01 PDT 2015


On Tue, May 5, 2015 at 12:22 PM, Matt Turner <mattst88 at gmail.com> wrote:
> On Wed, Apr 1, 2015 at 6:19 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>> This allows us to get rid of the visitor argument in is_copy_payload
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
>> index 09f0fad..e3cf2db 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
>> @@ -64,11 +64,8 @@ is_nop_mov(const fs_inst *inst)
>>  }
>>
>>  static bool
>> -is_copy_payload(const fs_visitor *v, const fs_inst *inst)
>> +is_copy_payload(const fs_inst *inst)
>>  {
>> -   if (v->alloc.sizes[inst->src[0].reg] != inst->regs_written)
>> -      return false;
>> -
>>     fs_reg reg = inst->src[0];
>>
>>     for (int i = 0; i < inst->sources; i++)
>> @@ -99,7 +96,10 @@ is_coalesce_candidate(const fs_visitor *v, const fs_inst *inst)
>>        return false;
>>
>>     if (inst->opcode == SHADER_OPCODE_LOAD_PAYLOAD) {
>> -      if (!is_copy_payload(v, inst)) {
>> +      if (v->alloc.sizes[inst->src[0].reg] != inst->regs_written)
>> +         return false;
>> +
>> +      if (!is_copy_payload(inst)) {
>>           return false;
>>        }
>>     }
>> --
>> 2.3.4
>
> What's the purpose of this? Checking the sizes seems like a necessary
> part, so why are you moving it out of the function?

Yeah, Ken said on IRC that he things we should do it for both
register_coalesce and CSE so I'm going to put it inside the
is_copy_payload header


More information about the mesa-dev mailing list