From: Vasily Khoruzhick Date: Sat, 1 Jun 2019 05:30:54 +0000 (-0700) Subject: lima/ppir: fix crash when program uses no registers at all X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5980565a37909c01281b483c371f5eec03e9689a;p=mesa.git 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 --- 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))