Mesa (master): i965/fs: Skip blocks in register coalescing interference check.

Matt Turner mattst88 at kemper.freedesktop.org
Fri Aug 28 18:27:04 UTC 2015


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Tue Aug 18 17:47:00 2015 -0700

i965/fs: Skip blocks in register coalescing interference check.

No need to walk through instructions in blocks we know don't contain our
registers' live ranges.

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 .../drivers/dri/i965/brw_fs_register_coalesce.cpp  |   34 ++++++++++++--------
 1 file changed, 20 insertions(+), 14 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 452aee5..0329bc3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp
@@ -115,25 +115,31 @@ can_coalesce_vars(brw::fs_live_variables *live_intervals,
     */
    int start_ip = MAX2(start_to, start_from);
    int end_ip = MIN2(end_to, end_from);
-   int scan_ip = -1;
 
-   foreach_block_and_inst(block, fs_inst, scan_inst, cfg) {
-      scan_ip++;
-
-      /* Ignore anything before the intersection of the live ranges */
-      if (scan_ip < start_ip)
+   foreach_block(block, cfg) {
+      if (block->end_ip < start_ip)
          continue;
 
-      /* Ignore the copying instruction itself */
-      if (scan_inst == inst)
-         continue;
+      int scan_ip = block->start_ip - 1;
+
+      foreach_inst_in_block(fs_inst, scan_inst, block) {
+         scan_ip++;
+
+         /* Ignore anything before the intersection of the live ranges */
+         if (scan_ip < start_ip)
+            continue;
+
+         /* Ignore the copying instruction itself */
+         if (scan_inst == inst)
+            continue;
 
-      if (scan_ip > end_ip)
-         return true; /* registers do not interfere */
+         if (scan_ip > end_ip)
+            return true; /* registers do not interfere */
 
-      if (scan_inst->overwrites_reg(inst->dst) ||
-          scan_inst->overwrites_reg(inst->src[0]))
-         return false; /* registers interfere */
+         if (scan_inst->overwrites_reg(inst->dst) ||
+             scan_inst->overwrites_reg(inst->src[0]))
+            return false; /* registers interfere */
+      }
    }
 
    return true;




More information about the mesa-commit mailing list