broadcom/compiler: make opt passes set current block
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 2 Nov 2021 08:09:07 +0000 (09:09 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 2 Nov 2021 11:17:01 +0000 (11:17 +0000)
commit6b9bd3f038d19df34bd5dd5c7adb70395ea994a6
treea8fdd99e8807a68bc6483bd23e45a4f6b185a55e
parent27cb4166b5923997a5566281477a8de326215669
broadcom/compiler: make opt passes set current block

Typically, optimization passes go through all the blocks in a shader
and make adjustments on the fly, so we always want them to update
the current block or the current block pointer will become outdated.

Also, we don't need to keep track of the previous current block
pointer to restore it, since optimization passes run after we have
completed conversion to VIR, and therefore, anything that comes after
that should always set the current block before emitting code.

Fixes debug assert crashes when running shader-db:
vir.c:1888: try_opt_ldunif: Assertion `found || &c->cur_block->instructions == c->cursor.link' failed

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13625>
src/broadcom/compiler/vir_opt_constant_alu.c
src/broadcom/compiler/vir_opt_copy_propagate.c
src/broadcom/compiler/vir_opt_dead_code.c
src/broadcom/compiler/vir_opt_redundant_flags.c