From d620529ddbd6e92b64d1716188ce9882bd30cf7c Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Thu, 24 Jul 2025 14:16:59 +0200 Subject: [PATCH] lima: ppir: fix check for discard_block in optimization 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: fa9ddbe82b3 ("lima: ppir: optimize branches") Signed-off-by: Erico Nunes Reviewed-by: Vasily Khoruzhick Part-of: --- src/gallium/drivers/lima/ir/pp/opt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/lima/ir/pp/opt.c b/src/gallium/drivers/lima/ir/pp/opt.c index d1768d97f77..f1a745bafea 100644 --- a/src/gallium/drivers/lima/ir/pp/opt.c +++ b/src/gallium/drivers/lima/ir/pp/opt.c @@ -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++) {