From cebf60e059655fea82c7f892bf8028565347d5b7 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Mon, 9 Mar 2026 09:42:03 +0000 Subject: [PATCH] nir/range_analysis: use uint16_t for sparse array elements ministat (nir_analyze_fp_class): Difference at 95.0% confidence -4484.55 +/- 1288.68 -0.205419% +/- 0.0589514% (Student's t, pooled s = 1521.99) This should also use less memory. Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Part-of: --- src/compiler/nir/nir_range_analysis.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c index 5070dd82fac..c1ea843ed2a 100644 --- a/src/compiler/nir/nir_range_analysis.c +++ b/src/compiler/nir/nir_range_analysis.c @@ -201,7 +201,7 @@ fp_lookup(void *table, uint32_t key, uint32_t *value) { nir_fp_analysis_state *state = table; if (BITSET_TEST(state->bitset, key)) { - *value = *(uint32_t *)util_sparse_array_get(&state->arr, key); + *value = *(uint16_t *)util_sparse_array_get(&state->arr, key); return true; } else { return false; @@ -214,7 +214,7 @@ fp_insert(void *table, uint32_t key, uint32_t value) nir_fp_analysis_state *state = table; BITSET_SET(state->bitset, key); state->max = MAX2(state->max, (int)key); - *(uint32_t *)util_sparse_array_get(&state->arr, key) = value; + *(uint16_t *)util_sparse_array_get(&state->arr, key) = value; } static fp_class_mask @@ -1398,7 +1398,7 @@ nir_create_fp_analysis_state(nir_function_impl *impl) state.size = BITSET_BYTES(impl->ssa_alloc + impl->ssa_alloc / 4u); state.max = -1; state.bitset = calloc(state.size, 1); - util_sparse_array_init(&state.arr, 4, 256); + util_sparse_array_init(&state.arr, 2, 256); return state; }