Mesa (master): i965/fs: Eliminate null-dst instructions without side-effects.

Matt Turner mattst88 at kemper.freedesktop.org
Sat Jan 24 01:56:21 UTC 2015


Module: Mesa
Branch: master
Commit: 3759a89ad358139ef981bd5d46261ee115762b94
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3759a89ad358139ef981bd5d46261ee115762b94

Author: Matt Turner <mattst88 at gmail.com>
Date:   Fri Aug 22 11:01:13 2014 -0700

i965/fs: Eliminate null-dst instructions without side-effects.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
index 81be4de..d66808b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
@@ -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);




More information about the mesa-commit mailing list