On Thu, Jul 5, 2018 at 12:55 PM, Caio Marcelo de Oliveira Filho <
caio.olive...@intel.com> wrote:

> On Wed, Jul 04, 2018 at 09:55:26AM -0700, Jason Ekstrand wrote:
> > Removes an instruction from one place and inserts it at another while
> > working around a weird cursor corner-case.
>
> Is the weird corner case the move to the same place case?
>

Yes


> > --- a/src/compiler/nir/nir.c
> > +++ b/src/compiler/nir/nir.c
> > @@ -845,6 +845,21 @@ nir_instr_insert(nir_cursor cursor, nir_instr
> *instr)
> >        nir_handle_add_jump(instr->block);
> >  }
> >
> > +void
> > +nir_instr_move(nir_cursor cursor, nir_instr *instr)
> > +{
> > +   /* If the cursor happens to refer to this instruction (either before
> or
> > +    * after), don't do anything.
> > +    */
> > +   if ((cursor.option == nir_cursor_before_instr ||
> > +        cursor.option == nir_cursor_after_instr) &&
> > +       cursor.instr == instr)
> > +      return;
>
> Should we also consider the block-based cursor options here? Moving
> the first instruction of a block before that block
> (nir_cursor_before_block), etc.
>

That should be fine as-is as nir_instr_insert should do the right thing.
The reason the cursor.instr == instr case is a problem is because you can't
insert an instruction relative to itself.

--Jason
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to