i965/vs: Clear tracked copy propagation values whose source gets overwritten.
authorEric Anholt <eric@anholt.net>
Thu, 1 Sep 2011 23:40:07 +0000 (16:40 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 9 Sep 2011 04:40:39 +0000 (21:40 -0700)
This only occurs for GRFs, and hasn't mattered until now because we
only copy propagated non-GRFs.

src/mesa/drivers/dri/i965/brw_vec4_copy_propagation.cpp

index 4b33df1f105b4f25e987b78fa0874735606cb0ca..7862d78ab3390af782b1b94c247f14f1e4f84d4a 100644 (file)
@@ -289,9 +289,6 @@ vec4_visitor::opt_copy_propagation()
 
       /* For any updated channels, clear tracking of them as a source
        * or destination.
-       *
-       * FINISHME: Sources aren't handled, which will need to be done
-       * for copy propagation.
        */
       if (inst->dst.file == GRF) {
         if (inst->dst.reladdr)
@@ -303,6 +300,18 @@ vec4_visitor::opt_copy_propagation()
               if (inst->dst.writemask & (1 << i))
                  cur_value[reg][i] = NULL;
            }
+
+           for (int i = 0; i < virtual_grf_reg_count; i++) {
+              for (int j = 0; j < 4; j++) {
+                 if (inst->dst.writemask & (1 << i) &&
+                     cur_value[i][j] &&
+                     cur_value[i][j]->file == GRF &&
+                     cur_value[i][j]->reg == inst->dst.reg &&
+                     cur_value[i][j]->reg == inst->dst.reg) {
+                    cur_value[i][j] = NULL;
+                 }
+              }
+           }
         }
       }
    }