lima/ppir: fix crash when program uses no registers at all
authorVasily Khoruzhick <anarsoul@gmail.com>
Sat, 1 Jun 2019 05:30:54 +0000 (22:30 -0700)
committerVasily Khoruzhick <anarsoul@gmail.com>
Thu, 6 Jun 2019 04:30:36 +0000 (04:30 +0000)
Program may need no regalloc at all, e.g. in case when program consists
of single discard op.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
src/gallium/drivers/lima/ir/pp/regalloc.c

index 6aa71e91cfe2109fa767791b81aa4ad24a535429..dee530ca2b674f9902a61f5fd19bdf05a50042a8 100644 (file)
@@ -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))