i965/fs: Only sweep NOPs if register coalescing made progress.
authorMatt Turner <mattst88@gmail.com>
Tue, 15 Apr 2014 23:28:04 +0000 (16:28 -0700)
committerMatt Turner <mattst88@gmail.com>
Fri, 18 Apr 2014 16:16:19 +0000 (09:16 -0700)
Otherwise there's nothing to do.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp

index 4e3b611197ad823ff2f8c2c50f13f3f96458fb3a..f6d9b680b22ba9ca9defab438228ea839b60abfa 100644 (file)
@@ -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;
 }