[Mesa-dev] [PATCH 5/9] nir: Add a local dead write vars removal pass

Caio Marcelo de Oliveira Filho caio.oliveira at intel.com
Wed Aug 29 20:19:37 UTC 2018


Jason Ekstrand <jason at jlekstrand.net> writes:

>> >> +static bool
>> >> +remove_dead_write_vars_local(struct state *state, nir_block *block)
>> >> +{
>> >> +   bool progress = false;
>> >> +
>> >> +   struct util_dynarray unused_writes;
>> >> +   util_dynarray_init(&unused_writes, state->mem_ctx);
>> >> +
>> >> +   nir_foreach_instr_safe(instr, block) {
>> >>
>> >
>> > It wouldn't hurt to add a case for call instructions which does a barrier
>> > on everything I mentioned below as well as globals and locals.
>>
>> Makes sense.  But I don't get locals are affect?  Is this to cover the
>> parameters being passed to the call?
>>
>
> Because a deref to a local might be passed in as a parameter.  This is the
> way pass-by-reference works for SPIR-V.

Will the parameter appear to the new function as local too?  If so, will
they be tagged in a way I can identify the derefs?

I'm thinking about what to do with unused writes for locals at the end
of a function.  If it's the main function, we can just remove them, but
depending on the answer of the question above, it is not so clear for
non-main functions.


Thanks,
Caio



More information about the mesa-dev mailing list