nir/lower_vec_to_movs: Don't emit unneeded movs
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 23 Sep 2015 04:32:06 +0000 (21:32 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 23 Sep 2015 17:12:39 +0000 (10:12 -0700)
commit8dcbca59572a856ca554af9ab3f52120b6f2a929
tree7b9d7133f641b1d1d2272c32800583047b49627c
parent65e80ce5b565953ffb07586790eeea51199ca9cf
nir/lower_vec_to_movs: Don't emit unneeded movs

It's possible that, if a vecN operation is involved in a phi node, that we
could end up moving from a register to itself.  If swizzling is involved,
we need to emit the move but.  However, if there is no swizzling, then the
mov is a no-op and we might as well not bother emitting it.

Shader-db results on Haswell:

   total instructions in shared programs: 6262536 -> 6259558 (-0.05%)
   instructions in affected programs:     184780 -> 181802 (-1.61%)
   helped:                                838
   HURT:                                  0

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