nir: properly clear the entry sources in copy_prop_vars
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Sat, 15 Dec 2018 06:19:24 +0000 (22:19 -0800)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Wed, 19 Dec 2018 16:35:48 +0000 (08:35 -0800)
commit0ddc911f4d83a3c698ea02696e1b8706b2cce381
treecb0a6fe94c408ddbb843d10d2db2d0329e976f5e
parent0e4c7c3d5b28f88037455fbe15de62c613d8d6c4
nir: properly clear the entry sources in copy_prop_vars

When updating a copy entry source value from a "non-SSA" (the data
come from a copy instruction) to a "SSA" (the data or parts of it come
from SSA values), it was possible to hold invalid data in ssa[0]
depending on the writemask.  Because the union, ssa[0] could contain a
pointer to a nir_deref_instr left-over from previous non-SSA usage.

Change code to clean up the array before use to avoid invalid data
around.

Fixes: 62332d139c8 "nir: Add a local variable-based copy propagation pass"
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_opt_copy_prop_vars.c