i965/vec4: Don't dead code eliminate instructions writing the flag.
authorMatt Turner <mattst88@gmail.com>
Tue, 11 Mar 2014 20:07:42 +0000 (13:07 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 24 Mar 2014 18:06:26 +0000 (11:06 -0700)
A future patch adds support for removing dead writes to the flag
register. This patch simplifies the logic until then.

total instructions in shared programs: 811813 -> 811869 (0.01%)
instructions in affected programs:     3378 -> 3434 (1.66%)

Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_vec4.cpp

index cb87fecf8d8cb1850eb90f6e52f7e82134c39a2d..d07e8c558c2d760578580a7ca15ceae0234187a5 100644 (file)
@@ -356,7 +356,11 @@ vec4_visitor::dead_code_eliminate()
             inst->dst = dst_reg(retype(brw_null_reg(), inst->dst.type));
             break;
          default:
-            inst->remove();
+            if (inst->writes_flag()) {
+               inst->dst = dst_reg(retype(brw_null_reg(), inst->dst.type));
+            } else {
+               inst->remove();
+            }
             break;
          }
          progress = true;