Mesa (master): nir/constant_folding: Fix source bit size logic

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Dec 16 21:03:23 UTC 2018


Module: Mesa
Branch: master
Commit: 3595a0abf43be3ce27d88f5939b257a74e90035b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3595a0abf43be3ce27d88f5939b257a74e90035b

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Dec  6 14:31:20 2018 -0600

nir/constant_folding: Fix source bit size logic

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"
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Tested-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/compiler/nir/nir_opt_constant_folding.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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




More information about the mesa-commit mailing list