summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-08-31 11:07:58 -0700
committerKenneth Graunke <[email protected]>2014-09-05 09:08:59 -0700
commit3e248e0418370373ac5bcee4b0a88b501b5b22a9 (patch)
tree58602d6ef23498d66702484b554c100350531c44 /src
parent1a00f247512f22e58548053a99a706615a178672 (diff)
i965/fs: Connect cfg properly in predicated break peephole.
If the ENDIF instruction was the only instruction in its block, we'd leave the successors of the merged if+jump block in a bad state. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83080 Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
index ab197ee4694..eb9968179f2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp
@@ -87,13 +87,18 @@ fs_visitor::opt_peephole_predicated_break()
}
if_inst->remove(if_block);
+
+ bblock_t *later_block = endif_block;
+ if (endif_block->start_ip == endif_block->end_ip) {
+ later_block = (bblock_t *)endif_block->link.next;
+ }
endif_inst->remove(endif_block);
- if_block->children.make_empty();
- endif_block->parents.make_empty();
+ earlier_block->children.make_empty();
+ later_block->parents.make_empty();
- if_block->add_successor(cfg->mem_ctx, jump_block);
- jump_block->add_successor(cfg->mem_ctx, endif_block);
+ earlier_block->add_successor(cfg->mem_ctx, jump_block);
+ jump_block->add_successor(cfg->mem_ctx, later_block);
if (earlier_block->can_combine_with(jump_block)) {
earlier_block->combine_with(jump_block);