On Thu, Nov 6, 2014 at 10:07 AM, Jason Ekstrand <[email protected]> wrote: > > > On Wed, Nov 5, 2014 at 4:13 PM, Matt Turner <[email protected]> wrote: >> >> 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. >> --- >> src/mesa/drivers/dri/i965/brw_fs_peephole_predicated_break.cpp | 10 >> +++++++--- >> 1 file changed, 7 insertions(+), 3 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 b7a1d7e..047c2c0 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 >> @@ -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(); >> + } > > > I *think* this is correct. I didn't really understand it before and I don't > 100% now.
Basically, the earlier code incorrectly assumed that the blocks were were attempting to merge did not start/end in control flow and therefore had only a single successor. In that case it was safe to erase all of the successor/predecessors and recreate them. When the blocks actually start/end with control flow, they have multiple successors/predecessors and that assumption is false. In that case, we're not going to be able to merge blocks and we shouldn't destroy their successor/predecessor information. _______________________________________________ mesa-dev mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-dev
