[Mesa-dev] [PATCH 1/2] i965: Combine some dead code elimination NOP'ing code.

Kenneth Graunke kenneth at whitecape.org
Sat Jan 14 01:20:02 UTC 2017


In theory we might have incorrectly NOP'd instructions that write the
flag, but where that flag value isn't used, and yet the instruction
either writes the accumulator or has side effects.

I don't believe any such instructions exist, so this is mostly a
code cleanup.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

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 8a0469a51b9..930dc733b45 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
@@ -70,17 +70,11 @@ fs_visitor::dead_code_eliminate()
             }
          }
 
-         if (inst->dst.is_null() && inst->flags_written()) {
-            if (!(flag_live[0] & inst->flags_written())) {
-               inst->opcode = BRW_OPCODE_NOP;
-               progress = true;
-            }
-         }
-
          if ((inst->opcode != BRW_OPCODE_IF &&
               inst->opcode != BRW_OPCODE_WHILE) &&
              inst->dst.is_null() &&
              !inst->has_side_effects() &&
+             !(flag_live[0] & inst->flags_written()) &&
              !inst->flags_written() &&
              !inst->writes_accumulator) {
             inst->opcode = BRW_OPCODE_NOP;
-- 
2.11.0



More information about the mesa-dev mailing list