nir/constant_folding: fix incorrect bit-size check
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 31 Oct 2018 11:18:34 +0000 (12:18 +0100)
committerIago Toral Quiroga <itoral@igalia.com>
Fri, 9 Nov 2018 07:22:15 +0000 (08:22 +0100)
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.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
src/compiler/nir/nir_opt_constant_folding.c

index 5929a60aee807a9e9af89f3f5eed9d6526b7cad0..1fca530af2436f6db6ee72a29507883eaa329e6d 100644 (file)
@@ -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;