nir/shrink_vectors: shrink ALU properly
authorDaniel Schürmann <daniel@schuermann.dev>
Wed, 7 Jul 2021 14:43:13 +0000 (16:43 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 26 Jul 2021 09:24:37 +0000 (09:24 +0000)
commit36fe7398c01a081c73cff30fbc15d0d6734dc289
treeb92affa87f57ce54a31ab9099487a480ff2749e3
parent8317fe314c992b5bd70e80721176d4d89954eb7c
nir/shrink_vectors: shrink ALU properly

ALU instructions of which not all components are read,
can be shrunk to the number of read components.
Previously, this would only remove trailing components.

This patch enables to remove components from any position.

Stat changes for softpipe:
total instructions in shared programs: 3001291 -> 2984698 (-0.55%)
instructions in affected programs: 225585 -> 208992 (-7.36%)
total loops in shared programs: 1389 -> 1358 (-2.23%)
loops in affected programs: 36 -> 5 (-86.11%)

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11411>
src/compiler/nir/nir_opt_shrink_vectors.c