[Mesa-dev] [PATCH] nir/constant_folding: fix incorrect bit-size check

Samuel Iglesias Gonsálvez siglesias at igalia.com
Thu Nov 8 07:29:53 UTC 2018


Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

Sam

On Wednesday, 31 October 2018 12:18:34 (CET) Iago Toral Quiroga wrote:
> nir_alu_type_get_type_size takes a type as parameter and we were
> passing a bit-size instead, which did what we wanted by accident,
> since a bit-size of zero matches nir_type_invalid, which has a
> size of 0 too.
> ---
>  src/compiler/nir/nir_opt_constant_folding.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/compiler/nir/nir_opt_constant_folding.c
> b/src/compiler/nir/nir_opt_constant_folding.c index
> e5ec5e9583f..c91e7e16855 100644
> --- a/src/compiler/nir/nir_opt_constant_folding.c
> +++ b/src/compiler/nir/nir_opt_constant_folding.c
> @@ -63,10 +63,8 @@ constant_fold_alu_instr(nir_alu_instr *instr, void
> *mem_ctx) if (!instr->src[i].src.is_ssa)
>           return false;
> 
> -      if (bit_size == 0 &&
> -         
> !nir_alu_type_get_type_size(nir_op_infos[instr->op].input_sizes[i])) { +   
>   if (bit_size == 0 && nir_op_infos[instr->op].input_sizes[i] == 0)
> bit_size = instr->src[i].src.ssa->bit_size;
> -      }
> 
>        nir_instr *src_instr = instr->src[i].src.ssa->parent_instr;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181108/991c2940/attachment.sig>


More information about the mesa-dev mailing list