Mesa (master): i965/vec4: Don't emit null MOVs in CSE.

Matt Turner mattst88 at kemper.freedesktop.org
Mon Jul 7 01:36:37 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Wed Jun 11 15:24:52 2014 -0700

i965/vec4: Don't emit null MOVs in CSE.

Port of commit 219b43c6 to the vec4 code.

---

 src/mesa/drivers/dri/i965/brw_vec4_cse.cpp |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
index 296142b..f3a69ed 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_cse.cpp
@@ -159,7 +159,7 @@ vec4_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
              * If we don't have a temporary already, make one.
              */
             bool no_existing_temp = entry->tmp.file == BAD_FILE;
-            if (no_existing_temp) {
+            if (no_existing_temp && !entry->generator->dst.is_null()) {
                entry->tmp = src_reg(this, glsl_type::float_type);
                entry->tmp.type = inst->dst.type;
                entry->tmp.swizzle = BRW_SWIZZLE_XYZW;
@@ -170,10 +170,12 @@ vec4_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
             }
 
             /* dest <- temp */
-            assert(inst->dst.type == entry->tmp.type);
-            vec4_instruction *copy = MOV(inst->dst, entry->tmp);
-            copy->force_writemask_all = inst->force_writemask_all;
-            inst->insert_before(copy);
+            if (!inst->dst.is_null()) {
+               assert(inst->dst.type == entry->tmp.type);
+               vec4_instruction *copy = MOV(inst->dst, entry->tmp);
+               copy->force_writemask_all = inst->force_writemask_all;
+               inst->insert_before(copy);
+            }
 
             /* Set our iterator so that next time through the loop inst->next
              * will get the instruction in the basic block after the one we've




More information about the mesa-commit mailing list