[Mesa-dev] [PATCH] nir/constant_folding: Fix source bit size logic

Jason Ekstrand jason at jlekstrand.net
Thu Dec 6 20:35:07 UTC 2018


Instead of looking at input_sizes[i] which contains the number of
components for each source, we look at the bit size of input_types[i].
This fixes a regression in the 1-bit boolean series though I have no
idea how we haven't seen it before now.

Fixes: 35baee5dce5 "nir/constant_folding: fix incorrect bit-size check"
Fixes: 9076c4e289d "nir: update opcode definitions for different bit sizes"
---
 src/compiler/nir/nir_opt_constant_folding.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c
index c91e7e16855..49abd70bdc9 100644
--- a/src/compiler/nir/nir_opt_constant_folding.c
+++ b/src/compiler/nir/nir_opt_constant_folding.c
@@ -63,7 +63,9 @@ 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_op_infos[instr->op].input_sizes[i] == 0)
+      unsigned src_bit_size =
+         nir_alu_type_get_type_size(nir_op_infos[instr->op].input_types[i]);
+      if (bit_size == 0 && src_bit_size == 0)
          bit_size = instr->src[i].src.ssa->bit_size;
 
       nir_instr *src_instr = instr->src[i].src.ssa->parent_instr;
-- 
2.19.2



More information about the mesa-dev mailing list