From cacb390ec9466c312d773e65ef0ea0c8efe0e7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 16 Sep 2025 11:30:41 +0200 Subject: [PATCH] nir/load_store_vectorize: Fix parsing offsets through u2u64 Fixes: cfba41731665bc27d460afa3d4a5aece3d6b6edd ('nir/load_store_vectorize: optimize accesses with u2u64(ishl.nuw(iadd))') Part-of: --- src/compiler/nir/nir_opt_load_store_vectorize.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/compiler/nir/nir_opt_load_store_vectorize.c b/src/compiler/nir/nir_opt_load_store_vectorize.c index 8c858205871..c12b83f7d20 100644 --- a/src/compiler/nir/nir_opt_load_store_vectorize.c +++ b/src/compiler/nir/nir_opt_load_store_vectorize.c @@ -400,13 +400,16 @@ parse_offset(nir_scalar base, uint64_t *offset) add += add2 * mul; } - if (nir_scalar_is_alu(base) && (nir_scalar_alu_op(base) == nir_op_mov || - nir_scalar_alu_op(base) == nir_op_u2u64)) { - if (nir_scalar_alu_op(base) == nir_op_u2u64) { + if (nir_scalar_is_alu(base)) { + if (nir_scalar_alu_op(base) == nir_op_mov) { + base = nir_scalar_chase_alu_src(base, 0); + } else if (nir_scalar_alu_op(base) == nir_op_u2u64) { + base = nir_scalar_chase_alu_src(base, 0); require_nuw = true; uub = u_uintN_max(base.def->bit_size); + } else { + continue; } - base = nir_scalar_chase_alu_src(base, 0); progress = true; } } while (progress);