From: Jason Ekstrand Date: Tue, 29 Dec 2015 23:44:37 +0000 (-0800) Subject: nir/spirv: Use instr_rewrite_src for updating phi sources X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2a58cb03d04b8cff632e6be70f1bef0ec12d9f0b;p=mesa.git nir/spirv: Use instr_rewrite_src for updating phi sources You can't just add a new source to a phi because use/def information won't get updated properly. Instead, you have to use one of the core helpers. Some day, we may want to add a nir_phi_instr_add_src helper. --- diff --git a/src/glsl/nir/spirv/spirv_to_nir.c b/src/glsl/nir/spirv/spirv_to_nir.c index da586533529..b6e38704887 100644 --- a/src/glsl/nir/spirv/spirv_to_nir.c +++ b/src/glsl/nir/spirv/spirv_to_nir.c @@ -3039,8 +3039,10 @@ vtn_phi_node_add_src(struct vtn_ssa_value *phi, const nir_block *pred, nir_phi_instr *phi_instr = nir_instr_as_phi(phi->def->parent_instr); nir_phi_src *src = ralloc(phi_instr, nir_phi_src); src->pred = (nir_block *) pred; - src->src = nir_src_for_ssa(val->def); + src->src = NIR_SRC_INIT; exec_list_push_tail(&phi_instr->srcs, &src->node); + nir_instr_rewrite_src(&phi_instr->instr, &src->src, + nir_src_for_ssa(val->def)); } else { unsigned elems = glsl_get_length(phi->type); for (unsigned i = 0; i < elems; i++)