freedreno/ir3: don't cp into phi's
authorRob Clark <robclark@freedesktop.org>
Mon, 4 Apr 2016 21:34:57 +0000 (17:34 -0400)
committerRob Clark <robclark@freedesktop.org>
Tue, 5 Apr 2016 00:18:18 +0000 (20:18 -0400)
The block defining a phi source might not have been executed.  If we
allow copy propagation, we could end up pointing to a src instruction in
the wrong block.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/ir3/ir3_cp.c

index 00fa353..f032f0b 100644 (file)
@@ -230,6 +230,12 @@ reg_cp(struct ir3_instruction *instr, struct ir3_register *reg, unsigned n)
 {
        struct ir3_instruction *src = ssa(reg);
 
+       /* don't propagate copies into a PHI, since we don't know if the
+        * src block executed:
+        */
+       if (instr->opc == OPC_META_PHI)
+               return;
+
        if (is_eligible_mov(src, true)) {
                /* simple case, no immed/const/relativ, only mov's w/ ssa src: */
                struct ir3_register *src_reg = src->regs[1];