Matt Turner <matts...@gmail.com> writes:

> We'd like to CSE some instructions, like CMP, that often have null
> destinations. Instead of replacing them with MOVs to null, just don't
> emit the MOV.
> ---
>  src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 42 
> +++++++++++++++++++-------------
>  1 file changed, 25 insertions(+), 17 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> index 0afc5f6..55de10b 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp

> +            /* inst->prev points to copy iff copy != NULL. */
> +            fs_inst *prev = (fs_inst *)inst->prev;
> +
>              inst->remove();
>  
>           /* Appending an instruction may have changed our bblock end. */
>           if (inst == block->end) {
> -            block->end = copy;
> +            block->end = prev;
>           }
>  
> -         /* Continue iteration with copy->next */
> -         inst = copy;
> +            /* Continue iteration with copy->next iff copy != NULL or
> +             * prev->next otherwise.
> +             */
> +            inst = prev;
>        }

I think all 3 comments here could be replaced by a single comment for
the whole block:

             /* Set our iterator so that next time through the loop inst->next
              * will get the instruction in the basic block after the
              * one we've removed.
              */

(On reading, I was thinking there was something important about tracking
"copy" still as of these comments, but we don't care)

Attachment: pgpsicZZ0pC__.pgp
Description: PGP signature

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

Reply via email to