Mesa (master): i965: Make DCE explicitly not eliminate any control flow instructions.

Kenneth Graunke kwg at kemper.freedesktop.org
Wed Jan 18 05:45:39 UTC 2017


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Jan 17 19:15:50 2017 -0800

i965: Make DCE explicitly not eliminate any control flow instructions.

According to Matt, the dead code pass explicitly avoided IF and WHILE
because on Sandybridge, these could have conditional modifiers and
null destination registers.  Normally, those instructions use BAD_FILE
for the destination register.  Nowadays, we don't do that anymore, so
we could technically drop these checks.

However, it's clearer to explicitly leave control flow instructions
alone, so change it to the more generic !inst->is_control_flow().

This should have no actual change.

[This patch implements review feedback from Curro and Matt.]

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Francisco Jerez <currojerez at riseup.net>
Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 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 8a0469a..04901a9 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
@@ -77,9 +77,8 @@ fs_visitor::dead_code_eliminate()
             }
          }
 
-         if ((inst->opcode != BRW_OPCODE_IF &&
-              inst->opcode != BRW_OPCODE_WHILE) &&
-             inst->dst.is_null() &&
+         if (inst->dst.is_null() &&
+             !inst->is_control_flow() &&
              !inst->has_side_effects() &&
              !inst->flags_written() &&
              !inst->writes_accumulator) {




More information about the mesa-commit mailing list