nir: Take if_uses into account when repairing SSA
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Thu, 4 Apr 2019 19:46:42 +0000 (12:46 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 5 Apr 2019 16:43:46 +0000 (09:43 -0700)
commitc037dbb0efad573aab1467befd35d2c4f4cdbbce
treed95bc34960b23d50b752e61c6d770b4eabf4a533
parent26e161b1e942564b649d355df359fc2e22b46188
nir: Take if_uses into account when repairing SSA

If a def is used as an condition before its definition, we should also
consider this a case to repair.  When repairing, make sure we rewrite
any if conditions too.

Found in while inspecting a SPIR-V conversion from a 'continue block'
that contains a conditional branch.  We pull the continue block up to
the beggining of the loop, and the condition in the branch ends up
defined afterwards.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Fixes: 364212f1ede4b "nir: Add a pass to repair SSA form"
src/compiler/nir/nir_repair_ssa.c