i965/fs: Extend remove_duplicate_mrf_writes() to handle non-VGRF to MRF copies.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 25 May 2016 20:17:41 +0000 (13:17 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 31 May 2016 22:57:41 +0000 (15:57 -0700)
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/mesa/drivers/dri/i965/brw_fs.cpp

index 5d5b98a12ad243cfc91c7d2f64c1733719a3142d..00d937e30a73d46bfe8de6f249dc9df60e31c3ec 100644 (file)
@@ -3112,18 +3112,18 @@ fs_visitor::remove_duplicate_mrf_writes()
       }
 
       /* Clear out any MRF move records whose sources got overwritten. */
-      if (inst->dst.file == VGRF) {
-        for (unsigned int i = 0; i < ARRAY_SIZE(last_mrf_move); i++) {
-           if (last_mrf_move[i] &&
-                last_mrf_move[i]->src[0].nr == inst->dst.nr) {
-              last_mrf_move[i] = NULL;
-           }
-        }
+      for (unsigned i = 0; i < ARRAY_SIZE(last_mrf_move); i++) {
+         if (last_mrf_move[i] &&
+             regions_overlap(inst->dst, inst->regs_written * REG_SIZE,
+                             last_mrf_move[i]->src[0],
+                             last_mrf_move[i]->regs_read(0) * REG_SIZE)) {
+            last_mrf_move[i] = NULL;
+         }
       }
 
       if (inst->opcode == BRW_OPCODE_MOV &&
          inst->dst.file == MRF &&
-         inst->src[0].file == VGRF &&
+         inst->src[0].file != ARF &&
          !inst->is_partial_write()) {
          last_mrf_move[inst->dst.nr] = inst;
       }