From 6e899b3eba45ffbc1117c6880a84d8fec9c294e5 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Thu, 5 Feb 2026 09:34:48 +0100 Subject: [PATCH] nir/opt_vectorize_load_store: allow sizes unaligned with high offset for loads This was added specifically for vectorized stores, so allow for loads. Without this, the pass will fail to vectorize 2 consecutive 16-bit loads into a single 32-bit load. Fixes: 2ed79f80ba89 ("nir/load_store_vectorize: Skip new bit-sizes that are unaligned with high_offset") Reviewed-by: Rhys Perry (cherry picked from commit f6a2d1400854dfbe617d93f448f16e98a1744015) Part-of: --- .pick_status.json | 2 +- src/compiler/nir/nir_opt_load_store_vectorize.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index c13c660bd17..c6f91c257a6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1304,7 +1304,7 @@ "description": "nir/opt_vectorize_load_store: allow sizes unaligned with high offset for loads", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "2ed79f80ba894bba0d340708c326ac9d59d5795e", "notes": null diff --git a/src/compiler/nir/nir_opt_load_store_vectorize.c b/src/compiler/nir/nir_opt_load_store_vectorize.c index 8b1e1acdae1..71ea51f32e0 100644 --- a/src/compiler/nir/nir_opt_load_store_vectorize.c +++ b/src/compiler/nir/nir_opt_load_store_vectorize.c @@ -821,7 +821,7 @@ new_bitsize_acceptable(struct vectorize_ctx *ctx, unsigned new_bit_size, unsigned high_offset = get_offset_diff(low, high); /* This can cause issues when combining store data. */ - if (high_offset % (new_bit_size / 8) != 0) + if (low->is_store && (high_offset % (new_bit_size / 8) != 0)) return false; /* check nir_extract_bits limitations */