[Mesa-dev] [PATCH 1/2] nir: Add a safety check that we don't remove dead I/O vars after lowering.

Eric Anholt eric at anholt.net
Tue Oct 17 22:58:53 UTC 2017


Timothy Arceri <tarceri at itsqueeze.com> writes:

> On 18/10/17 07:52, Eric Anholt wrote:
>> The pass only looks at var load/store intrinsics, not input load/store
>> intrinsics, so assert that we don't see the other type.
>> ---
>> 
>> I tripped over this limitation when trying to use the NIR linking
>> helpers in vc4.
>> 
>>   src/compiler/nir/nir_remove_dead_variables.c | 20 ++++++++++++++++----
>>   1 file changed, 16 insertions(+), 4 deletions(-)
>> 
>> diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c
>> index a1fe0de9c61f..7a676f2309c4 100644
>> --- a/src/compiler/nir/nir_remove_dead_variables.c
>> +++ b/src/compiler/nir/nir_remove_dead_variables.c
>> @@ -28,7 +28,8 @@
>>   #include "nir.h"
>>   
>>   static void
>> -add_var_use_intrinsic(nir_intrinsic_instr *instr, struct set *live)
>> +add_var_use_intrinsic(nir_intrinsic_instr *instr, struct set *live,
>> +                      nir_variable_mode modes)
>>   {
>>      unsigned num_vars = nir_intrinsic_infos[instr->intrinsic].num_variables;
>>   
>> @@ -47,6 +48,16 @@ add_var_use_intrinsic(nir_intrinsic_instr *instr, struct set *live)
>>         break;
>>      }
>>   
>> +      /* This pass can't be used on I/O variables after they've been
>> +       * lowered.
>> +       */
>
> Shouldn't this be aligned with the case rather since its not inside the 
> case? Either way both patches:
>
> Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

Oh, yeah, that's emacs behavior that I don't like either.  Fixed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20171017/5eb18495/attachment.sig>


More information about the mesa-dev mailing list