i965/fs: Wire up control flow correctly in predicated break pass.
authorMatt Turner <mattst88@gmail.com>
Wed, 5 Nov 2014 23:23:05 +0000 (15:23 -0800)
committerMatt Turner <mattst88@gmail.com>
Fri, 7 Nov 2014 00:37:56 +0000 (16:37 -0800)
When the earlier block ended with control flow, we'd mistakenly remove
some of its links to its children. The same happened with the later
block.

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

index b7a1d7e772274ce6e3e22c8614eaeef8c399ea28..047c2c0b1cf5f0e75d9ff9d13cb4133ec3dfbc61 100644 (file)
@@ -107,10 +107,14 @@ fs_visitor::opt_peephole_predicated_break()
       }
       endif_inst->remove(endif_block);
 
-      earlier_block->children.make_empty();
-      later_block->parents.make_empty();
+      if (!earlier_block->ends_with_control_flow()) {
+         earlier_block->children.make_empty();
+         earlier_block->add_successor(cfg->mem_ctx, jump_block);
+      }
 
-      earlier_block->add_successor(cfg->mem_ctx, jump_block);
+      if (!later_block->starts_with_control_flow()) {
+         later_block->parents.make_empty();
+      }
       jump_block->add_successor(cfg->mem_ctx, later_block);
 
       if (earlier_block->can_combine_with(jump_block)) {