nv50/ir: fix surface lowering when values get shared accross operations
authorKarol Herbst <kherbst@redhat.com>
Tue, 16 Jun 2020 18:17:55 +0000 (20:17 +0200)
committerKarol Herbst <kherbst@redhat.com>
Wed, 16 Jun 2021 09:58:18 +0000 (11:58 +0200)
commitc1f938b6475b1c936a78f6aacf76a1601c87a0bb
tree9f5630a909c12e51d222eb532d2c21d6e9219d2b
parent561f9ae74b2b7da06bb4830aaca8d017a3dd2746
nv50/ir: fix surface lowering when values get shared accross operations

With nir I encountered the case where the same value can be written to from
multiple surface operations. This caused some weird messups with the unions
as the def.rewrite operations caused unrelated instructions to get new their
value replaced as well.

In order to replace def.rewrite, we have to create a new temp value, write
to that one instead and move to the original value.

Fixes: 869e32593a9 ("gm107/ir: fix loading z offset for layered 3d image bindings")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11053>
src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp