nir/validate: Validated dests after sources
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 12 Nov 2015 18:38:12 +0000 (10:38 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 23 Nov 2015 19:04:49 +0000 (11:04 -0800)
commit03c9ad900e4f1feb2a4df8dd0c563937d999ae5d
tree2ece03fdd023f0961835602f5094c60b38aecde2
parent6c8ba59cff14a1a86273f4008ff2a8e68335ab25
nir/validate: Validated dests after sources

Previously, if someone accidentally made an instruction that refers to its
own SSA destination, the validator wouldn't catch it.  The reason for this
is that it validated the destination too early and, by the time it got to
the source, the destination SSA value was already added to the set of seen
SSA values so it would assume that it came from some previous instruction.
By moving destination validation to be after source validation, the SSA
value is not in the list of seen values and the validator will catch
self-referential instructions.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir_validate.c