intel/nir: Lower array-deref-of-vector UBO and SSBO loads

This fixes a serious performance issue with DXVK:

https://github.com/doitsujin/dxvk/issues/937

This was caused by a recent change that to improve performance on RADV
which back-fired on ANV and killed performance for some apps:

https://github.com/doitsujin/dxvk/commit/e5a06d3f4a103a54cd4eb51970fedee405d1d698

Throwing in this bit of lowering lets us come along and CSE those UBO
loads (or copy-prop for SSBO load) and get one load where we previously
would have gotten several.

VkPipeline-db results on Kaby Lake:

    total instructions in shared programs: 5115361 -> 5073185 (-0.82%)
    instructions in affected programs: 1754333 -> 1712157 (-2.40%)
    helped: 5331
    HURT: 63

    total cycles in shared programs: 2544501169 -> 2481144545 (-2.49%)
    cycles in affected programs: 2531058653 -> 2467702029 (-2.50%)
    helped: 9202
    HURT: 4323

    total loops in shared programs: 3340 -> 3331 (-0.27%)
    loops in affected programs: 9 -> 0
    helped: 9
    HURT: 0

    total spills in shared programs: 3246 -> 3053 (-5.95%)
    spills in affected programs: 384 -> 191 (-50.26%)
    helped: 10
    HURT: 5

    total fills in shared programs: 4626 -> 4452 (-3.76%)
    fills in affected programs: 439 -> 265 (-39.64%)
    helped: 10
    HURT: 5

All of the shaders with hurt spilling were in Rise of the Tomb Raider
which also had shaders solidly helped in the spilling department.  Not
shown in those results (because I've not had success dumping the
shaders) is Witcher 3 where this reduces spilling and improves over-all
perf by around 20-25%.  There were no shader-db changes.  Apparently,
this just isn't a pattern that happens in OpenGL.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Cc: "19.0" mesa-stable@lists.freedesktop.org
21 jobs for !455 with review/nir-lower-array-of-vec in 21 minutes and 2 seconds (queued for 2 seconds)
detached
Status Job ID Name Coverage
  Containers Build
passed #175784
ubuntu

00:01:28

 
  Build+Test
passed #175798
make-gallium-drivers-other

00:17:52

passed #175797
make-gallium-drivers-radeonsi

00:11:53

passed #175796
make-gallium-drivers-swr

00:13:22

passed #175799
make-gallium-st-clover-llvm

00:12:11

passed #175800
make-gallium-st-clover-llvm-39

00:12:05

passed #175801
make-gallium-st-other

00:06:33

passed #175795
make-loader-classic-dri

00:08:21

passed #175794
make-vulkan

00:07:14

passed #175791
meson-gallium-clover-llvm

00:06:26

passed #175792
meson-gallium-clover-llvm39

00:05:45

passed #175790
meson-gallium-drivers-other

00:06:50

passed #175789
meson-gallium-radeonsi

00:01:46

passed #175793
meson-gallium-st-other

00:02:23

passed #175788
meson-gallium-swr

00:08:52

passed #175787
meson-glvnd

00:07:07

passed #175786
meson-loader-classic-dri

00:06:16

passed #175785
meson-vulkan

00:03:47

passed #175803
scons-llvm

00:04:30

passed #175802
scons-nollvm

00:05:37

passed #175804
scons-swr

00:06:17