lima: ppir: fix check for discard_block in optimization
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

uses_discard may be set when the nir shader contains a 'discard'
implemented with a nir 'terminate', in that case it may stil not
necessarily have a discard block.
Fixes a crash in shaders that have comp->uses_discard but no
comp->discard_block.

Fixes: fa9ddbe82b ("lima: ppir: optimize branches")

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36350>
This commit is contained in:
Erico Nunes 2025-07-24 14:16:59 +02:00 committed by Marge Bot
parent 740daef360
commit d620529ddb

View file

@ -374,7 +374,7 @@ static bool ppir_dce(ppir_compiler *comp)
/* Block 0 is entry, it is always reachable */
BITSET_SET(reachable, 0);
/* Discard block is always reachable */
if (comp->uses_discard)
if (comp->discard_block)
BITSET_SET(reachable, comp->discard_block->index);
list_for_each_entry(ppir_block, block, &comp->block_list, list) {
for (int i = 0; i < 2; i++) {