i965/vec4: split VEC4_OPCODE_FROM_DOUBLE into one opcode per destination's type
[mesa.git] / src / compiler / nir / nir_phi_builder.c
index f96dad78dd855eb1e682c77bbed27571a478d52f..883884bb7f5729ca374c637d602f04bcff458235 100644 (file)
@@ -81,7 +81,7 @@ struct nir_phi_builder_value {
 struct nir_phi_builder *
 nir_phi_builder_create(nir_function_impl *impl)
 {
-   struct nir_phi_builder *pb = ralloc(NULL, struct nir_phi_builder);
+   struct nir_phi_builder *pb = rzalloc(NULL, struct nir_phi_builder);
 
    pb->shader = impl->function->shader;
    pb->impl = impl;
@@ -216,7 +216,7 @@ nir_phi_builder_value_get_block_def(struct nir_phi_builder_value *val,
                         val->bit_size, NULL);
       phi->instr.block = dom;
       exec_list_push_tail(&val->phis, &phi->instr.node);
-      def = &phi->dest.ssa;
+      def = val->defs[dom->index] = &phi->dest.ssa;
    } else {
       /* In this case, we have an actual SSA def.  It's either the result of a
        * phi node created by the case above or one passed to us through
@@ -241,8 +241,8 @@ nir_phi_builder_value_get_block_def(struct nir_phi_builder_value *val,
 static int
 compare_blocks(const void *_a, const void *_b)
 {
-   nir_block * const * a = _a;
-   nir_block * const * b = _b;
+   const nir_block * const * a = _a;
+   const nir_block * const * b = _b;
 
    return (*a)->index - (*b)->index;
 }