Mesa (master): lima/ppir: handle failures on all ppir_emit_cf_list paths

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat May 16 15:43:16 UTC 2020


Module: Mesa
Branch: master
Commit: 96c1d5f629b3e45958e5ee41d7d8b34e52ae247d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=96c1d5f629b3e45958e5ee41d7d8b34e52ae247d

Author: Erico Nunes <nunes.erico at gmail.com>
Date:   Sun Apr 19 21:36:19 2020 +0200

lima/ppir: handle failures on all ppir_emit_cf_list paths

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 at gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4975>

---

 src/gallium/drivers/lima/ir/pp/nir.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/lima/ir/pp/nir.c b/src/gallium/drivers/lima/ir/pp/nir.c
index 620ecbed4d2..5b24d610970 100644
--- a/src/gallium/drivers/lima/ir/pp/nir.c
+++ b/src/gallium/drivers/lima/ir/pp/nir.c
@@ -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);



More information about the mesa-commit mailing list