glsl: Avoid extra if statements for logic and/or with no side effects.
authorEric Anholt <eric@anholt.net>
Wed, 8 Feb 2012 06:59:24 +0000 (22:59 -0800)
committerEric Anholt <eric@anholt.net>
Tue, 13 Mar 2012 20:50:08 +0000 (13:50 -0700)
commitead3589aa2810b66164178a1d55d2063cfa3b041
tree14cf2e5f97a12efcbdf8ffd22d9d71c93e37dd0f
parentb536ac6b2bc54ad9bb6e58fbd307055e419a288f
glsl: Avoid extra if statements for logic and/or with no side effects.

This avoids extra if statements in the common case of just comparing
two expressions that don't involve assignments or function calls,
along with simplifying the handling of constant expressions.  Reduces
i965 instructions generated in unigine tropics and sanctuary,
yofrankie, warsow, gstreamer shaders, and the weston compositor.

shader-db results:
Total instructions: 213052 -> 212752
38/1246 programs affected (3.0%)
14309 -> 14009 instructions in affected programs (2.1% reduction)
src/glsl/ast_to_hir.cpp