[Mesa-dev] [PATCH 1/6] i965/fs: Only sweep NOPs if register coalescing made progress.

Matt Turner mattst88 at gmail.com
Wed Apr 16 11:06:40 PDT 2014


Otherwise there's nothing to do.
---
 src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
index 4e3b611..f6d9b68 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
@@ -170,6 +170,8 @@ fs_visitor::register_coalesce()
       if (!can_coalesce)
          continue;
 
+      progress = true;
+
       for (int i = 0; i < src_size; i++) {
          if (mov[i]) {
             mov[i]->opcode = BRW_OPCODE_NOP;
@@ -215,17 +217,17 @@ fs_visitor::register_coalesce()
       reg_from = -1;
    }
 
-   foreach_list_safe(node, &this->instructions) {
-      fs_inst *inst = (fs_inst *)node;
+   if (progress) {
+      foreach_list_safe(node, &this->instructions) {
+         fs_inst *inst = (fs_inst *)node;
 
-      if (inst->opcode == BRW_OPCODE_NOP) {
-         inst->remove();
-         progress = true;
+         if (inst->opcode == BRW_OPCODE_NOP) {
+            inst->remove();
+         }
       }
-   }
 
-   if (progress)
       invalidate_live_intervals();
+   }
 
    return progress;
 }
-- 
1.8.3.2



More information about the mesa-dev mailing list