pan/bi: Use nir_undef_to_zero

We don't handle undefs explicitly in NIR->BIR which means if they aren't
optimized out they won't be RA'd to anything and then backend RA will
crash (as occurs in a glamor shader seen in MATE).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
This commit is contained in:
Alyssa Rosenzweig 2020-10-15 08:47:40 -04:00 committed by Marge Bot
parent 86b2b4eb76
commit 81b28ebcb5

View file

@ -1609,8 +1609,7 @@ emit_instr(bi_context *ctx, struct nir_instr *instr)
break;
case nir_instr_type_ssa_undef:
/* Spurious */
break;
unreachable("should've been lowered");
default:
unreachable("Unhandled instruction type");
@ -1852,6 +1851,8 @@ bi_optimize_nir(nir_shader *nir)
}
NIR_PASS(progress, nir, nir_opt_undef);
NIR_PASS(progress, nir, nir_undef_to_zero);
NIR_PASS(progress, nir, nir_opt_loop_unroll,
nir_var_shader_in |
nir_var_shader_out |