spirv: Silence compiler warning about undefined srcs[0]
authorEric Anholt <eric@anholt.net>
Wed, 21 Feb 2018 04:28:09 +0000 (20:28 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 13 Mar 2018 17:32:55 +0000 (10:32 -0700)
v2: Use assume() at the srcs[] definition instead.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/compiler/spirv/spirv_to_nir.c

index 6a358c5973168b2b3ff6e4c71d6f63375e03c12e..3de45c47371e24ceaffdf46a0822345f4e6dec9c 100644 (file)
@@ -2925,6 +2925,7 @@ vtn_handle_composite(struct vtn_builder *b, SpvOp opcode,
 
    case SpvOpCompositeConstruct: {
       unsigned elems = count - 3;
+      assume(elems >= 1);
       if (glsl_type_is_vector_or_scalar(type)) {
          nir_ssa_def *srcs[4];
          for (unsigned i = 0; i < elems; i++)