i965/vs: Allow copy propagation on GRFs.
authorEric Anholt <eric@anholt.net>
Thu, 1 Sep 2011 23:43:38 +0000 (16:43 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 9 Sep 2011 04:40:39 +0000 (21:40 -0700)
Further reduces instruction count by 4.0% in 40.7% of the vertex
shaders.

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

index 7862d78ab3390af782b1b94c247f14f1e4f84d4a..c46735abfab85a5edbcd7466be40bd446372b3b6 100644 (file)
@@ -187,6 +187,7 @@ try_copy_propagation(struct intel_context *intel,
    value.swizzle = BRW_SWIZZLE4(s[0], s[1], s[2], s[3]);
 
    if (value.file != UNIFORM &&
+       value.file != GRF &&
        value.file != ATTR)
       return false;
 
@@ -204,6 +205,10 @@ try_copy_propagation(struct intel_context *intel,
    if (intel->gen >= 6 && inst->is_math())
       return false;
 
+   /* Don't report progress if this is a noop. */
+   if (value.equals(&inst->src[arg]))
+      return false;
+
    inst->src[arg] = value;
    return true;
 }
@@ -307,7 +312,7 @@ vec4_visitor::opt_copy_propagation()
                      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]->reg_offset == inst->dst.reg_offset) {
                     cur_value[i][j] = NULL;
                  }
               }