From 5980565a37909c01281b483c371f5eec03e9689a Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Fri, 31 May 2019 22:30:54 -0700 Subject: [PATCH] lima/ppir: fix crash when program uses no registers at all Program may need no regalloc at all, e.g. in case when program consists of single discard op. Signed-off-by: Vasily Khoruzhick Reviewed-by: Qiang Yu --- src/gallium/drivers/lima/ir/pp/regalloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/drivers/lima/ir/pp/regalloc.c b/src/gallium/drivers/lima/ir/pp/regalloc.c index 6aa71e91cfe..dee530ca2b6 100644 --- a/src/gallium/drivers/lima/ir/pp/regalloc.c +++ b/src/gallium/drivers/lima/ir/pp/regalloc.c @@ -747,6 +747,10 @@ bool ppir_regalloc_prog(ppir_compiler *comp) ppir_regalloc_update_reglist_ssa(comp); + /* No registers? Probably shader consists of discard instruction */ + if (list_empty(&comp->reg_list)) + return true; + /* this will most likely succeed in the first * try, except for very complicated shaders */ while (!ppir_regalloc_prog_try(comp, &spilled)) -- 2.30.2