[Mesa-dev] [PATCH 04/15] i965/fs: Don't emit null MOVs in CSE.

Eric Anholt eric at anholt.net
Tue Oct 29 06:58:47 CET 2013


Matt Turner <mattst88 at 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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131028/25a36b06/attachment.pgp>


More information about the mesa-dev mailing list