From da76dfb5159c2ca8ee24d64a5f85a68f28b70c65 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tapani=20P=C3=A4lli?= Date: Tue, 4 Feb 2020 14:58:17 +0200 Subject: [PATCH] intel/vec4: fix valgrind errors with vf_values array MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes valgrind errors introduced since commit a8ec4082. Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2346 Fixes: a8ec4082 ("nir+vtn: vec8+vec16 support") Signed-off-by: Tapani Pälli Reviewed-by: Matt Turner Tested-by: Marge Bot Part-of: --- src/intel/compiler/brw_vec4_nir.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/intel/compiler/brw_vec4_nir.cpp b/src/intel/compiler/brw_vec4_nir.cpp index d32f65a..31219b4 100644 --- a/src/intel/compiler/brw_vec4_nir.cpp +++ b/src/intel/compiler/brw_vec4_nir.cpp @@ -1030,7 +1030,8 @@ try_immediate_source(const nir_alu_instr *instr, src_reg *op, } else { uint8_t vf_values[4] = { 0, 0, 0, 0 }; - for (unsigned i = 0; i < NIR_MAX_VEC_COMPONENTS; i++) { + for (unsigned i = 0; i < ARRAY_SIZE(vf_values); i++) { + if (op[idx].abs) f[i] = fabs(f[i]); -- 2.7.4