nir/gcm: fix a bug with metadata handling
authorConnor Abbott <cwabbott0@gmail.com>
Sat, 14 Jan 2017 23:08:11 +0000 (18:08 -0500)
committerConnor Abbott <cwabbott0@gmail.com>
Sat, 14 Jan 2017 23:18:17 +0000 (18:18 -0500)
commitc9b74f3f0306a3305ad62644a7c7ef1e4a3f19f1
tree9ba956776cec33f32e037852be1e630f400a8070
parentbf8e1f9e7b26acecab1fc63a526ce3d10eae4c61
nir/gcm: fix a bug with metadata handling

We were using impl->num_blocks, but that isn't guaranteed to be
up-to-date until after the block_index metadata is required. If we were
unlucky, this could lead to overwriting memory.

Noticed by inspection.

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_opt_gcm.c