i965/fs: Eliminate null-dst instructions without side-effects.
authorMatt Turner <mattst88@gmail.com>
Fri, 22 Aug 2014 18:01:13 +0000 (11:01 -0700)
committerMatt Turner <mattst88@gmail.com>
Sat, 24 Jan 2015 01:57:40 +0000 (17:57 -0800)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp

index 81be4def30b3ba122ee18cd4accb62da376f8b11..d66808bf45c3335c9ae42183c2d8201d02b15460 100644 (file)
@@ -85,6 +85,17 @@ fs_visitor::dead_code_eliminate()
             }
          }
 
+         if ((inst->opcode != BRW_OPCODE_IF &&
+              inst->opcode != BRW_OPCODE_WHILE) &&
+             inst->dst.is_null() &&
+             !inst->has_side_effects() &&
+             !inst->writes_flag() &&
+             !inst->writes_accumulator) {
+            inst->opcode = BRW_OPCODE_NOP;
+            progress = true;
+            continue;
+         }
+
          if (inst->dst.file == GRF) {
             if (!inst->is_partial_write()) {
                int var = live_intervals->var_from_reg(inst->dst);