Module: Mesa Branch: main Commit: 19db6f1cd986782a36c3be63fe5c98b209f38331 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=19db6f1cd986782a36c3be63fe5c98b209f38331
Author: Ian Romanick <ian.d.roman...@intel.com> Date: Tue Sep 12 09:09:02 2023 -0700 intel/vec4: Don't emit an empty ELSE This matches the behavior of fs_visitor::nir_emit_if. This is not technically wrong, but the cfg_t generates some invalid parent / child links in this case. Reviewed-by: Caio Oliveira <caio.olive...@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25216> --- src/intel/compiler/brw_vec4_nir.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/intel/compiler/brw_vec4_nir.cpp b/src/intel/compiler/brw_vec4_nir.cpp index 0c742f852c4..f9f089be9c0 100644 --- a/src/intel/compiler/brw_vec4_nir.cpp +++ b/src/intel/compiler/brw_vec4_nir.cpp @@ -101,10 +101,10 @@ vec4_visitor::nir_emit_if(nir_if *if_stmt) nir_emit_cf_list(&if_stmt->then_list); - /* note: if the else is empty, dead CF elimination will remove it */ - emit(BRW_OPCODE_ELSE); - - nir_emit_cf_list(&if_stmt->else_list); + if (!nir_cf_list_is_empty_block(&if_stmt->else_list)) { + emit(BRW_OPCODE_ELSE); + nir_emit_cf_list(&if_stmt->else_list); + } emit(BRW_OPCODE_ENDIF); }