i965/fs: Walk instructions in reverse in saturate propagation.
authorMatt Turner <mattst88@gmail.com>
Mon, 8 Sep 2014 19:05:25 +0000 (12:05 -0700)
committerMatt Turner <mattst88@gmail.com>
Sat, 27 Sep 2014 19:18:37 +0000 (12:18 -0700)
When we find a mov.sat, we search backwards. We might as well search
everything else backwards as well and potentially look at fewer
instructions.

This change enables the next patch.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/drivers/dri/i965/brw_fs_saturate_propagation.cpp

index 4c4b6bf47a817e24e1f9dc8956c898efa2fc5bdb..6f8f8d05c0ceed98c8a90c5c26b865f5fe495723 100644 (file)
@@ -32,10 +32,10 @@ static bool
 opt_saturate_propagation_local(fs_visitor *v, bblock_t *block)
 {
    bool progress = false;
-   int ip = block->start_ip - 1;
+   int ip = block->end_ip + 1;
 
-   foreach_inst_in_block(fs_inst, inst, block) {
-      ip++;
+   foreach_inst_in_block_reverse(fs_inst, inst, block) {
+      ip--;
 
       if (inst->opcode != BRW_OPCODE_MOV ||
           inst->dst.file != GRF ||