lima/ppir: handle failures on all ppir_emit_cf_list paths
authorErico Nunes <nunes.erico@gmail.com>
Sun, 19 Apr 2020 19:36:19 +0000 (21:36 +0200)
committerErico Nunes <nunes.erico@gmail.com>
Sat, 16 May 2020 15:23:48 +0000 (17:23 +0200)
In some paths where ppir_emit_cf_list is called, compilation errors such
as in unsupported features were not being handled, allowing compilation
to continue and fail at some random point later.
Handle them properly so compilation aborts in the expected way rather
than what may look like a compiler crash/bug.

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/4975>

src/gallium/drivers/lima/ir/pp/nir.c

index 620ecbed4d23084a918bbaf773b8c654fb56d807..5b24d6109703292ac336d404a3b64c4d47f0842f 100644 (file)
@@ -627,7 +627,9 @@ static bool ppir_emit_if(ppir_compiler *comp, nir_if *if_stmt)
    else_branch->negate = true;
    list_addtail(&else_branch->node.list, &block->node_list);
 
-   ppir_emit_cf_list(comp, &if_stmt->then_list);
+   if (!ppir_emit_cf_list(comp, &if_stmt->then_list))
+      return false;
+
    if (empty_else_block) {
       nir_block *nblock = nir_if_last_else_block(if_stmt);
       assert(nblock->successors[0]);
@@ -654,7 +656,8 @@ static bool ppir_emit_if(ppir_compiler *comp, nir_if *if_stmt)
    /* Target should be after_block, will fixup later */
    list_addtail(&after_branch->node.list, &block->node_list);
 
-   ppir_emit_cf_list(comp, &if_stmt->else_list);
+   if (!ppir_emit_cf_list(comp, &if_stmt->else_list))
+      return false;
 
    return true;
 }
@@ -669,7 +672,8 @@ static bool ppir_emit_loop(ppir_compiler *comp, nir_loop *nloop)
 
    comp->loop_cont_block = ppir_get_block(comp, nir_loop_first_block(nloop));
 
-   ppir_emit_cf_list(comp, &nloop->body);
+   if (!ppir_emit_cf_list(comp, &nloop->body))
+      return false;
 
    loop_last_block = nir_loop_last_block(nloop);
    block = ppir_get_block(comp, loop_last_block);