The lcssa and phis_to_regs passes are used by various NIR optimizations
that modify the CFG. Putting a couple of asserts will help ensure that
we don't accidentally put derefs in phis as part of an optimization
pass.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
nir_foreach_phi_src(src, phi) {
assert(src->src.is_ssa);
+ /* We don't want derefs ending up in phi sources */
+ assert(!nir_src_as_deref(src->src));
place_phi_read(shader, reg, src->src.ssa, src->pred);
}
if (all_uses_inside_loop)
return true;
+ /* We don't want derefs ending up in phi sources */
+ assert(def->parent_instr->type != nir_instr_type_deref);
+
/* Initialize a phi-instruction */
nir_phi_instr *phi = nir_phi_instr_create(state->shader);
nir_ssa_dest_init(&phi->instr, &phi->dest,
nir_foreach_phi_src(src, instr) {
if (src->pred == pred) {
validate_assert(state, src->src.is_ssa);
+ validate_assert(state, src->src.ssa->parent_instr->type != nir_instr_type_deref);
validate_src(&src->src, state, instr->dest.ssa.bit_size,
instr->dest.ssa.num_components);
state->instr = NULL;