treewide: Avoid nir_lower_regs_to_ssa calls
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 23 May 2023 14:10:47 +0000 (10:10 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 24 May 2023 17:30:03 +0000 (17:30 +0000)
commitecd295bb8bfbc4c9d271ee8e8b4330b86876f8c2
tree8e32fe325c434653ba4d2e379881e6f71c6aec9c
parent6875f97618bc82fcf7315ae22d8ab91e082d3924
treewide: Avoid nir_lower_regs_to_ssa calls

nir_registers are only supposed to be used temporarily. They may be created by a
producer, but then must be immediately lowered prior to optimizing the produced
shader. They may be created internally by an optimization pass that doesn't want
to deal with phis, but that pass needs to lower them back to phis immediately.
Finally they may be created when going out-of-SSA if a backend chooses, but that
has to happen late.

Regardless, there should be no case where a backend sees a shader that comes in
with nir_registers needing to be lowered. The two frontend producers of
registers (tgsi_to_nir and mesa/st) both call nir_lower_regs_to_ssa to clean up
as they should. Some backend (like intel) already depend on this behaviour.
There's no need for other backends to call nir_lower_regs_to_ssa too.

Drop the pointless calls as a baby step towards replacing nir_register.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23181>
14 files changed:
src/asahi/compiler/agx_compile.c
src/freedreno/ir3/ir3_nir.c
src/gallium/auxiliary/nir/nir_to_tgsi.c
src/gallium/drivers/etnaviv/etnaviv_compiler_nir.c
src/gallium/drivers/freedreno/a2xx/ir2_nir.c
src/gallium/drivers/lima/lima_program.c
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/r600/sfn/sfn_nir.cpp
src/gallium/drivers/v3d/v3d_program.c
src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/zink/zink_compiler.c
src/nouveau/codegen/nv50_ir_from_nir.cpp
src/panfrost/compiler/bifrost_compile.c
src/panfrost/midgard/midgard_compile.c