Mesa (master): i965/fs: Fix basic block tracking in try_rep_send().

Kenneth Graunke kwg at kemper.freedesktop.org
Fri Sep 5 17:01:39 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Thu Sep  4 20:08:16 2014 -0700

i965/fs: Fix basic block tracking in try_rep_send().

The 'start' instruction is always in the current block, except for the
case of shader time, which emits code in a pattern seen no where else.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 23a8f2f..20acafa 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2314,6 +2314,7 @@ fs_visitor::try_rep_send()
 {
    int i, count;
    fs_inst *start = NULL;
+   bblock_t *mov_block;
 
    /* From the Ivybridge PRM, Volume 4 Part 1, section 3.9.11.2
     * ("Message Descriptor - Render Target Write"):
@@ -2343,15 +2344,19 @@ fs_visitor::try_rep_send()
     */
    count = 0;
    foreach_block_and_inst_safe(block, fs_inst, inst, cfg) {
-      if (count == 0)
+      if (count == 0) {
          start = inst;
+         mov_block = block;
+      }
       if (inst->opcode == BRW_OPCODE_MOV &&
 	  inst->dst.file == MRF &&
           inst->dst.reg == start->dst.reg + 2 * count &&
           inst->src[0].file == HW_REG &&
           inst->src[0].reg_offset == start->src[0].reg_offset + count) {
-         if (count == 0)
+         if (count == 0) {
             start = inst;
+            mov_block = block;
+         }
          count++;
       }
 
@@ -2381,9 +2386,9 @@ fs_visitor::try_rep_send()
          mov->dst.type = BRW_REGISTER_TYPE_F;
 
          /* Replace the four MOVs with the new vec4 MOV. */
-         start->insert_before(block, mov);
+         start->insert_before(mov_block, mov);
          for (i = 0; i < 4; i++)
-            ((fs_inst *) mov->next)->remove(block);
+            ((fs_inst *) mov->next)->remove(mov_block);
 
          /* Finally, adjust the message length and set the opcode to
           * REP_FB_WRITE for the send, so that the generator will use the




More information about the mesa-commit mailing list