Kenneth Graunke <kenn...@whitecape.org> writes:

> On 04/04/2014 03:28 PM, Matt Turner wrote:
>> The generator uses its destination as a source implicitly, which breaks
>> some assumptions in dead code elimination. Giving the instruction a
>> source allows us to reason about it better.
>> ---
>>  src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp 
>> b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
>> index 13d6d38..1321a94 100644
>> --- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
>> +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp
>> @@ -408,7 +408,8 @@ vec4_gs_visitor::emit_control_data_bits()
>>           src_reg channel_mask(this, glsl_type::uint_type);
>>           inst = emit(SHL(dst_reg(channel_mask), one, channel));
>>           inst->force_writemask_all = true;
>> -         emit(GS_OPCODE_PREPARE_CHANNEL_MASKS, dst_reg(channel_mask));
>> +         emit(GS_OPCODE_PREPARE_CHANNEL_MASKS, dst_reg(channel_mask),
>> +                                               channel_mask);
>>           emit(GS_OPCODE_SET_CHANNEL_MASKS, mrf_reg, channel_mask);
>>        }
>>  
>> 
>
> This seems reasonable, though I'd like to see generator changes to
> match.  Either use the source register, or at least:
>
>    assert(src[0] == dst);
>
> in both generators.

With Ken's change (or maybe you have to just assert on file and reg,
possibly):

Reviewed-by: Eric Anholt <e...@anholt.net>

I feel like I've used this strategy before for fixing up dead code
problems, but I just noticed that in general there's a risk of the dummy
source getting copy propagation happen to it, and then not actually
serving its purpose.  We know that's not the case here because we can
see the channel_mask setup right there.

Attachment: pgp75HDRrF2_N.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to