summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-07-25 13:37:28 -0700
committerEric Anholt <[email protected]>2019-07-29 12:50:49 -0700
commit3c46778b75b6d40a1384691333d70480c96938f4 (patch)
tree4755af75151d2cb7a4d9a265f21d5e90df9f3447 /src
parent91986fbbdb467ed2de16767432044ed5e389b189 (diff)
nir: Fix helgrind complaints about data race in trivial_swizzle init.
Even if the data race wasn't real (I'm not great at reasoning about this), helgrind is a nice enough tool that keeping noise out of it is probably worthwhile. Besides, typing out the numbers keeps the data in the read-only data section instead of emitting code to initialize it every time. Reviewed-by: Iago Toral Quiroga <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_builder.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 35e4a285714..2fed76106eb 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -807,9 +807,9 @@ nir_ssa_for_src(nir_builder *build, nir_src src, int num_components)
static inline nir_ssa_def *
nir_ssa_for_alu_src(nir_builder *build, nir_alu_instr *instr, unsigned srcn)
{
- static uint8_t trivial_swizzle[NIR_MAX_VEC_COMPONENTS];
- for (int i = 0; i < NIR_MAX_VEC_COMPONENTS; ++i)
- trivial_swizzle[i] = i;
+ static uint8_t trivial_swizzle[] = { 0, 1, 2, 3 };
+ STATIC_ASSERT(ARRAY_SIZE(trivial_swizzle) == NIR_MAX_VEC_COMPONENTS);
+
nir_alu_src *src = &instr->src[srcn];
unsigned num_components = nir_ssa_alu_instr_src_components(instr, srcn);