[Mesa-dev] [PATCH 10/19] i965/fs: Drop redundant zero assignments in fs_inst::init().

Matt Turner mattst88 at gmail.com
Fri Feb 21 15:07:46 PST 2014


On Fri, Feb 21, 2014 at 1:44 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On 02/20/2014 01:41 PM, Matt Turner wrote:
>> Unfortunately the compiler isn't able to recognize that assigning
>> reg_undef is just zeroing the fs_reg, which was already done by the
>> above memset.
>> ---
>>  src/mesa/drivers/dri/i965/brw_fs.cpp | 6 ------
>>  1 file changed, 6 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> index ae1237e..e51cdbd 100644
>> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
>> @@ -56,12 +56,6 @@ fs_inst::init()
>>  {
>>     memset(this, 0, sizeof(*this));
>>     this->opcode = BRW_OPCODE_NOP;
>> -   this->conditional_mod = BRW_CONDITIONAL_NONE;
>> -
>> -   this->dst = reg_undef;
>> -   this->src[0] = reg_undef;
>> -   this->src[1] = reg_undef;
>> -   this->src[2] = reg_undef;
>>
>>     /* This will be the case for almost all instructions. */
>>     this->regs_written = 1;
>>
>
> This is not equivalent.
>
> reg_undef has stride == 1.  Removing these lines will make stride == 0.

Hm, you're right. Although it'll get better when src is a pointer, I'm
still annoyed by memsetting the fs_regs, and then overwriting the
whole thing again for a single bit difference. I'll punt this.


More information about the mesa-dev mailing list