diff --git a/src/compiler/nir/nir_search_helpers.h b/src/compiler/nir/nir_search_helpers.h index 5de812f1e4c..cae9ef4f0bd 100644 --- a/src/compiler/nir/nir_search_helpers.h +++ b/src/compiler/nir/nir_search_helpers.h @@ -422,35 +422,15 @@ is_integral(struct hash_table *ht, const nir_alu_instr *instr, unsigned src, /** * Is the value finite? - * - * Doesn't actually use range tracking. Just checks that the value is a - * constant that is finite. */ static inline bool -is_finite(UNUSED struct hash_table *ht, const nir_alu_instr *instr, unsigned src, - unsigned num_components, const uint8_t *swizzle) +is_finite(UNUSED struct hash_table *ht, const nir_alu_instr *instr, + unsigned src, UNUSED unsigned num_components, + UNUSED const uint8_t *swizzle) { - if (nir_src_as_const_value(instr->src[src].src) == NULL) - return false; + const struct ssa_result_range v = nir_analyze_range(ht, instr, src); - for (unsigned i = 0; i < num_components; i++) { - nir_alu_type type = nir_op_infos[instr->op].input_types[src]; - switch (nir_alu_type_get_base_type(type)) { - case nir_type_float: - if (!isfinite(nir_src_comp_as_float(instr->src[src].src, swizzle[i]))) - return false; - break; - case nir_type_bool: - case nir_type_int: - case nir_type_uint: - /* Non-float types are always finite. */ - break; - default: - return false; - } - } - - return true; + return v.is_finite; }