From 46e94fd854e8f209ae662826e1794de4c5da2b80 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 31 Jan 2020 16:47:10 +0000 Subject: [PATCH] aco: skip NIR in unreachable merge blocks MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit NIR removes most of this but undef instructions for loop header phis can remain. These were harmless because ACO would DCE them itself. Signed-off-by: Rhys Perry CC: Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index 52db7f4a6b3..59668fb4bc1 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -8822,7 +8822,7 @@ static void end_divergent_if(isel_context *ctx, if_context *ic) } } -static void visit_if(isel_context *ctx, nir_if *if_stmt) +static bool visit_if(isel_context *ctx, nir_if *if_stmt) { Temp cond = get_ssa_temp(ctx, if_stmt->condition.ssa); Builder bld(ctx->program, ctx->block); @@ -8915,6 +8915,7 @@ static void visit_if(isel_context *ctx, nir_if *if_stmt) ctx->block = ctx->program->insert_block(std::move(BB_endif)); append_logical_start(ctx->block); } + return !ctx->cf_info.has_branch; } else { /* non-uniform condition */ /** * To maintain a logical and linear CFG without critical edges, @@ -8950,6 +8951,8 @@ static void visit_if(isel_context *ctx, nir_if *if_stmt) visit_cf_list(ctx, &if_stmt->else_list); end_divergent_if(ctx, &ic); + + return true; } } @@ -8962,7 +8965,8 @@ static void visit_cf_list(isel_context *ctx, visit_block(ctx, nir_cf_node_as_block(node)); break; case nir_cf_node_if: - visit_if(ctx, nir_cf_node_as_if(node)); + if (!visit_if(ctx, nir_cf_node_as_if(node))) + return; break; case nir_cf_node_loop: visit_loop(ctx, nir_cf_node_as_loop(node)); -- 2.30.2