nir/lower_vec_to_movs: Coalesce movs on-the-fly when possible
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 9 Sep 2015 21:40:06 +0000 (14:40 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 15 Sep 2015 19:38:07 +0000 (12:38 -0700)
commit2458ea95c5676807a064f24ec720f12506975402
tree96ddba5a578d276ebe526ae3c605f3f141c46ad0
parent2b2f1f16a04dfba4e02a7f331befb5bd94d4a1be
nir/lower_vec_to_movs: Coalesce movs on-the-fly when possible

The old pass blindly inserted a bunch of moves into the shader with no
concern for whether or not it was really needed.  This adds code to try and
coalesce into the destination of the instruction providing the value.

Shader-db results for vec4 shaders on Haswell:

   total instructions in shared programs: 1754420 -> 1747753 (-0.38%)
   instructions in affected programs:     231230 -> 224563 (-2.88%)
   helped:                                1017
   HURT:                                  2

This approach is heavily based on a different patch by Eduardo Lima Mitev
<elima@igalia.com>.  Eduardo's patch did this in a separate pass as opposed
to integrating it into nir_lower_vec_to_movs.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
src/glsl/nir/nir_lower_vec_to_movs.c