glsl2: Make ir_algebraic reassociate add/mul operands for constant folding.
authorEric Anholt <eric@anholt.net>
Tue, 27 Jul 2010 06:56:19 +0000 (23:56 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 10 Aug 2010 04:42:17 +0000 (21:42 -0700)
commit0ff3b2b344b21ae4a7b62ebba22d7358755c8dfe
tree1b6ff550d9d51fa39837dcab502a1bafb27e5639
parent5854d4583c6e8885185e12a0636f77489a62e24c
glsl2: Make ir_algebraic reassociate add/mul operands for constant folding.

It's rather easy to produce two constant multiplies separated by other
multiplies while writing a BRDF shader, and non-obvious enough in the
resulting codegen that I didn't catch it in my demo code until just
recently.  Cuts 3 965 instructions from my demo (<1%), and 20 from
glsl-fs-raytrace (1.3%).
src/glsl/ir_algebraic.cpp