nir/opt_shrink_vectors: add assume to silence warning

../../../../../../../mesa/src/compiler/nir/nir_opt_shrink_vectors.c: In function ‘shrink_dest_to_read_mask’:
../../../../../../../mesa/src/compiler/nir/nir_opt_shrink_vectors.c:140:36: warning: writing 16 bytes into a region of size 15 [-Wstringop-overflow=]
  140 |             swizzle[first_bit + i] = i;
      |             ~~~~~~~~~~~~~~~~~~~~~~~^~~
../../../../../../../mesa/src/compiler/nir/nir_opt_shrink_vectors.c:138:18: note: at offset [1, 15] into destination object ‘swizzle’ of size 16
  138 |          uint8_t swizzle[NIR_MAX_VEC_COMPONENTS] = { 0 };
      |                  ^~~~~~~

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34785>
This commit is contained in:
Rhys Perry
2025-05-01 12:48:51 +01:00
committed by Marge Bot
parent 5629332dcf
commit bc49045294

View File

@@ -114,6 +114,7 @@ shrink_dest_to_read_mask(nir_def *def, bool shrink_start)
if (first_bit) {
assert(shrink_start);
assume(comps < NIR_MAX_VEC_COMPONENTS);
if (nir_intrinsic_has_component(intr)) {
unsigned new_component = nir_intrinsic_component(intr) + first_bit;