i965/vec4: Fix handling of multiple register reads and writes during copy propagation.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 18 Mar 2015 17:46:54 +0000 (19:46 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Mon, 23 Mar 2015 12:12:52 +0000 (14:12 +0200)
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp

index a603dd65b98f3c61215c77cff1c7e5d128edf0d3..e897be299bae37bb2cf78033d383abe4717bce0f 100644 (file)
@@ -74,9 +74,8 @@ is_channel_updated(vec4_instruction *inst, src_reg *values[4], int ch)
    if (!src || src->file != GRF)
       return false;
 
-   return (src->reg == inst->dst.reg &&
-          src->reg_offset == inst->dst.reg_offset &&
-          inst->dst.writemask & (1 << BRW_GET_SWZ(src->swizzle, ch)));
+   return (src->in_range(inst->dst, inst->regs_written) &&
+           inst->dst.writemask & (1 << BRW_GET_SWZ(src->swizzle, ch)));
 }
 
 static unsigned
@@ -397,6 +396,10 @@ vec4_visitor::opt_copy_propagation(bool do_constant_prop)
             inst->src[i].reladdr)
            continue;
 
+         /* We only handle single-register copies. */
+         if (inst->regs_read(i) != 1)
+            continue;
+
         int reg = (alloc.offsets[inst->src[i].reg] +
                    inst->src[i].reg_offset);