summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-12-14 20:25:51 -0800
committerJason Ekstrand <[email protected]>2016-12-29 16:02:44 -0800
commit67a70889f61a374bc535286d12117780e9fbc0c3 (patch)
tree14cf46207bf0d5c35ee2c2e67d2265364e8b6238 /src/compiler
parentbaf1aa1334c61d505cde7e132b5f1bf4fa44a22c (diff)
nir/phi-builder: Set the value in the block when creating a phi
After we figure out the value that we are going to return, we have a loop that walks up the dominance tree and sets the value in each of the blocks that doesn't have one yet. In the case of the phi, the def is set to NEEDS_PHI not NULL, so the last one where the phi node actually goes never gets filled out. This can lead to duplicating the phi node unnecessarily.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_phi_builder.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_phi_builder.c b/src/compiler/nir/nir_phi_builder.c
index 6b4b6939917..acfc771da2f 100644
--- a/src/compiler/nir/nir_phi_builder.c
+++ b/src/compiler/nir/nir_phi_builder.c
@@ -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