summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-11-24 22:42:16 -0800
committerJason Ekstrand <[email protected]>2015-01-15 07:19:02 -0800
commit24249599b144364d2787a6866509ef7e07a2cffd (patch)
treecd61a36d54b870d5882b7bdb64c33eaae1ef8b3c
parent6a52d2af2f7594fcd76fcf6158eca531e48af1e3 (diff)
nir/copy_propagate: Don't cause size mismatches on phi node sources
Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r--src/glsl/nir/nir_opt_copy_propagate.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_opt_copy_propagate.c b/src/glsl/nir/nir_opt_copy_propagate.c
index a2be047a658..2feebe42c00 100644
--- a/src/glsl/nir/nir_opt_copy_propagate.c
+++ b/src/glsl/nir/nir_opt_copy_propagate.c
@@ -157,6 +157,18 @@ copy_prop_src(nir_src *src, nir_instr *parent_instr, nir_if *parent_if)
if (!is_swizzleless_move(alu_instr))
return false;
+ /* Don't let copy propagation land us with a phi that has more
+ * components in its source than it has in its destination. That badly
+ * messes up out-of-ssa.
+ */
+ if (parent_instr && parent_instr->type == nir_instr_type_phi) {
+ nir_phi_instr *phi = nir_instr_as_phi(parent_instr);
+ assert(phi->dest.is_ssa);
+ if (phi->dest.ssa.num_components !=
+ alu_instr->src[0].src.ssa->num_components)
+ return false;
+ }
+
if (parent_instr)
rewrite_src_instr(src, alu_instr->src[0].src.ssa, parent_instr);
else