glsl: Skip making a temporary for assignments when we don't need one.
authorEric Anholt <eric@anholt.net>
Thu, 6 Mar 2014 01:05:54 +0000 (17:05 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 8 Apr 2014 07:59:47 +0000 (00:59 -0700)
commite9822f77a9cc024f528d30382fd5ad21c73a173b
treea4ac719a37841c77a8112d598323a9a1752a5758
parentdff3439fef8690192bcc40108729da711fcf706b
glsl: Skip making a temporary for assignments when we don't need one.

While we wish our optimization passes could identify all the cases where
we can coalesce our variables, we miss out on a lot of opportunities.

total instructions in shared programs: 1673849 -> 1673166 (-0.04%)
instructions in affected programs:     299521 -> 298838 (-0.23%)
GAINED:                                7
LOST:                                  0

Note that many programs are "hurt".  The notable ones are where we produce
unrolling in cases we didn't before (presumably just because of the lower
instruction count).  But there are also some cases where pushing things
right into the variables prevents copy propagation and tree grafting,
since we don't split our variable usage webs apart.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/ast.h
src/glsl/ast_to_hir.cpp