<p dir="ltr">R-B me</p>
<div class="gmail_quote">On Jul 28, 2015 2:43 AM, "Francisco Jerez" <<a href="mailto:currojerez@riseup.net">currojerez@riseup.net</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">For some reason the loop that rewrites all occurrences of the<br>
coalesced register was iterating over all possible offsets until it<br>
would find one that compares equal to the offset of a source or<br>
destination of any instruction in the program.  Since the mapping<br>
between old and new offsets is already available in the regs_to_offset<br>
array and we know that the whole register has been coalesced we can<br>
just look it up.<br>
---<br>
 .../drivers/dri/i965/brw_fs_register_coalesce.cpp  | 27 +++++++++++-----------<br>
 1 file changed, 13 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp<br>
index c078318..6c80400 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_register_coalesce.cpp<br>
@@ -241,20 +241,19 @@ fs_visitor::register_coalesce()<br>
       }<br>
<br>
       foreach_block_and_inst(block, fs_inst, scan_inst, cfg) {<br>
-         for (int i = 0; i < src_size; i++) {<br>
-            if (scan_inst->dst.file == GRF &&<br>
-                scan_inst->dst.reg == reg_from &&<br>
-                scan_inst->dst.reg_offset == i) {<br>
-               scan_inst->dst.reg = reg_to;<br>
-               scan_inst->dst.reg_offset = reg_to_offset[i];<br>
-            }<br>
-            for (int j = 0; j < scan_inst->sources; j++) {<br>
-               if (scan_inst->src[j].file == GRF &&<br>
-                   scan_inst->src[j].reg == reg_from &&<br>
-                   scan_inst->src[j].reg_offset == i) {<br>
-                  scan_inst->src[j].reg = reg_to;<br>
-                  scan_inst->src[j].reg_offset = reg_to_offset[i];<br>
-               }<br>
+         if (scan_inst->dst.file == GRF &&<br>
+             scan_inst->dst.reg == reg_from) {<br>
+            scan_inst->dst.reg = reg_to;<br>
+            scan_inst->dst.reg_offset =<br>
+               reg_to_offset[scan_inst->dst.reg_offset];<br>
+         }<br>
+<br>
+         for (int j = 0; j < scan_inst->sources; j++) {<br>
+            if (scan_inst->src[j].file == GRF &&<br>
+                scan_inst->src[j].reg == reg_from) {<br>
+               scan_inst->src[j].reg = reg_to;<br>
+               scan_inst->src[j].reg_offset =<br>
+                  reg_to_offset[scan_inst->src[j].reg_offset];<br>
             }<br>
          }<br>
       }<br>
--<br>
2.4.6<br>
<br>
</blockquote></div>