Mesa (master): i965/fs: Don't use if_block/else_block in SEL peephole.

Matt Turner mattst88 at kemper.freedesktop.org
Tue Nov 11 19:54:31 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Mon Nov 10 22:02:38 2014 -0800

i965/fs: Don't use if_block/else_block in SEL peephole.

Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>

---

 src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
index c3bfd00..f18589c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
@@ -132,16 +132,21 @@ fs_visitor::opt_peephole_sel()
       if (if_inst->opcode != BRW_OPCODE_IF)
          continue;
 
-      if (!block->else_block)
-         continue;
-
-      assert(block->else_block->end()->opcode == BRW_OPCODE_ELSE);
-
       fs_inst *else_mov[MAX_MOVS] = { NULL };
       fs_inst *then_mov[MAX_MOVS] = { NULL };
 
       bblock_t *then_block = block->next();
-      bblock_t *else_block = block->else_block->next();
+      bblock_t *else_block = NULL;
+      foreach_list_typed(bblock_link, child, link, &block->children) {
+         if (child->block != then_block) {
+            if (child->block->prev()->end()->opcode == BRW_OPCODE_ELSE) {
+               else_block = child->block;
+            }
+            break;
+         }
+      }
+      if (else_block == NULL)
+         continue;
 
       int movs = count_movs_from_if(then_mov, else_mov, then_block, else_block);
 




More information about the mesa-commit mailing list