From 81b28ebcb5a3801216e752cfda2e600bbc7bcb10 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 15 Oct 2020 08:47:40 -0400 Subject: [PATCH] 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 Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 99f4a16..1ed06dc 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -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 | -- 2.7.4