gallivm: Use NIR_PASS macros

These run nir_validate in debug builds, which will avoid bugs slipping in. It's
not enough that llvmpipe doesn't mind illegal NIR, these passes are well within
their rights to fail spectacularly if the NIR wouldn't validate. So validate so
we catch issues early.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23804>
This commit is contained in:
Alyssa Rosenzweig 2023-06-22 11:08:19 -04:00
parent 6689c678fe
commit fadcd8d371

View file

@ -2794,14 +2794,14 @@ bool lp_build_nir_llvm(struct lp_build_nir_context *bld_base,
{
struct nir_function *func;
nir_convert_from_ssa(nir, true);
nir_lower_locals_to_regs(nir, 32);
nir_remove_dead_derefs(nir);
nir_remove_dead_variables(nir, nir_var_function_temp, NULL);
NIR_PASS_V(nir, nir_convert_from_ssa, true);
NIR_PASS_V(nir, nir_lower_locals_to_regs, 32);
NIR_PASS_V(nir, nir_remove_dead_derefs);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp, NULL);
if (is_aos(bld_base)) {
nir_move_vec_src_uses_to_dest(nir);
nir_lower_vec_to_movs(nir, NULL, NULL);
NIR_PASS_V(nir, nir_move_vec_src_uses_to_dest);
NIR_PASS_V(nir, nir_lower_vec_to_movs, NULL, NULL);
}
nir_foreach_shader_out_variable(variable, nir)