[Mesa-dev] [PATCH 07/12] i965/vec4: Don't dead code eliminate instructions writing the flag.

Matt Turner mattst88 at gmail.com
Tue Mar 18 20:23:28 PDT 2014


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%)
---
 src/mesa/drivers/dri/i965/brw_vec4.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index cb87fec..d07e8c5 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -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;
-- 
1.8.3.2



More information about the mesa-dev mailing list