[Mesa-dev] [PATCH 2/2] i965/fs: Add a local common subexpression elimination pass.

Eric Anholt eric at anholt.net
Mon May 14 13:58:03 PDT 2012


On Thu, 10 May 2012 16:10:15 -0700, Kenneth Graunke <kenneth at whitecape.org> wrote:
> Total instructions: 18210 -> 17836
> 49/163 programs affected (30.1%)
> 12888 -> 12514 instructions in affected programs (2.9% reduction)
> 
> This reduces Lightsmark's "Scale down filter" shader from 395
> instructions to 283, a whopping 28%.  It also reduces register pressure
> significantly: the SIMD8 program now uses 29 registers instead of 101,
> giving us more than enough room for a SIMD16 program.

> +   for (fs_inst *inst = block->start;
> +	inst != block->end->next;
> +	inst = (fs_inst *) inst->next) {
> +
> +      /* Skip some cases. */
> +      if (is_expression(inst) && !inst->predicated && inst->mlen == 0 &&
> +          !inst->force_uncompressed && !inst->force_sechalf)

I think you also want to check for !inst->conditional_mod -- you
wouldn't want to lose an instruction updating the condition flags just
because its expression matched something else.

Other than that,

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120514/b9bbbcc0/attachment.pgp>


More information about the mesa-dev mailing list