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.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25216>
This commit is contained in:
Ian Romanick 2023-09-12 09:09:02 -07:00 committed by Marge Bot
parent f3d99e3535
commit 19db6f1cd9

View file

@ -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);
}