[Mesa-dev] [PATCH 10/21] nir/dominance: Handle unreachable blocks

Jason Ekstrand jason at jlekstrand.net
Fri Mar 18 05:28:56 UTC 2016


On Wed, Feb 24, 2016 at 10:02 PM, Connor Abbott <cwabbott0 at gmail.com> wrote:

> I believe this is correct, and won't cause any issues with phi node
> placement, etc. before dead_cf comes and gets rid any code in the
> unreachable block(s).
>
> Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
>
> BTW, I'd ask that you hold off on pushing this until I at least get a
> chance to look at the phi builder stuff. I've already talked with you
> about the return lowering pass, and the inlining itself shouldn't be
> *that* bad, but when I glanced at the phi builder interface I couldn't
> grasp quite what was going on.
>

Um... Ping?  I'd really like to get the rest of this pushed as soon as I
can.


>
>
> On Sat, Feb 13, 2016 at 9:14 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > Previously, nir_dominance.c didn't properly handle unreachable blocks.
> > This can happen if, for instance, you have something like this:
> >
> > loop {
> >    if (...) {
> >       break;
> >    } else {
> >       break;
> >    }
> > }
> >
> > In this case, the block right after the if statement will be unreachable.
> > This commit makes two changes to handle this.  First, it removes an
> assert
> > and allows block->imm_dom to be null if the block is unreachable.
> Second,
> > it properly skips unreachable blocks in calc_dom_frontier_cb.
> >
> > Cc: Connor Abbott <cwabbott0 at gmail.com>
> > ---
> >  src/compiler/nir/nir_dominance.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/compiler/nir/nir_dominance.c
> b/src/compiler/nir/nir_dominance.c
> > index b345b85..d95f396 100644
> > --- a/src/compiler/nir/nir_dominance.c
> > +++ b/src/compiler/nir/nir_dominance.c
> > @@ -94,7 +94,6 @@ calc_dominance_cb(nir_block *block, void *_state)
> >        }
> >     }
> >
> > -   assert(new_idom);
> >     if (block->imm_dom != new_idom) {
> >        block->imm_dom = new_idom;
> >        state->progress = true;
> > @@ -112,6 +111,11 @@ calc_dom_frontier_cb(nir_block *block, void *state)
> >        struct set_entry *entry;
> >        set_foreach(block->predecessors, entry) {
> >           nir_block *runner = (nir_block *) entry->key;
> > +
> > +         /* Skip unreachable predecessors */
> > +         if (runner->imm_dom == NULL)
> > +            continue;
> > +
> >           while (runner != block->imm_dom) {
> >              _mesa_set_add(runner->dom_frontier, block);
> >              runner = runner->imm_dom;
> > --
> > 2.5.0.400.gff86faf
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160317/13f231e0/attachment.html>


More information about the mesa-dev mailing list