summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2018-10-31 12:18:34 +0100
committerIago Toral Quiroga <[email protected]>2018-11-09 08:22:15 +0100
commit35baee5dce5eaa8785e0abc09c9a4d5f2aac97d4 (patch)
treea453e8800765d8564007195d1a62272552d5fc78
parent6c418dfa42bfe38dc4525c9d2df12d0798ee64d3 (diff)
nir/constant_folding: fix incorrect bit-size check
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 <[email protected]>
-rw-r--r--src/compiler/nir/nir_opt_constant_folding.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_opt_constant_folding.c b/src/compiler/nir/nir_opt_constant_folding.c
index 5929a60aee8..1fca530af24 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;