From 96c1d5f629b3e45958e5ee41d7d8b34e52ae247d Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Sun, 19 Apr 2020 21:36:19 +0200 Subject: [PATCH] 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 Reviewed-by: Vasily Khoruzhick Part-of: --- 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); -- 2.30.2