From: Konstantin Seurer Date: Tue, 20 Dec 2022 17:26:34 +0000 (+0100) Subject: nir/lower_shader_calls: Remat derefs before lowering resumes X-Git-Tag: upstream/23.3.3~11105 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=200e551cbb36c201b0083c6a6ba8930c9077a6e8;p=platform%2Fupstream%2Fmesa.git nir/lower_shader_calls: Remat derefs before lowering resumes Closes: #7923 cc: mesa-stable Reviewed-by: Lionel Landwerlin Part-of: --- diff --git a/src/compiler/nir/nir_lower_shader_calls.c b/src/compiler/nir/nir_lower_shader_calls.c index 03a924f..d0144ea 100644 --- a/src/compiler/nir/nir_lower_shader_calls.c +++ b/src/compiler/nir/nir_lower_shader_calls.c @@ -1184,6 +1184,13 @@ lower_resume(nir_shader *shader, int call_idx) nir_function_impl *impl = nir_shader_get_entrypoint(shader); nir_instr *resume_instr = find_resume_instr(impl, call_idx); + /* Deref chains contain metadata information that is needed by other passes + * after this one. If we don't rematerialize the derefs in the blocks where + * they're used here, the following lowerings will insert phis which can + * prevent other passes from chasing deref chains. + */ + nir_rematerialize_derefs_in_use_blocks_impl(impl); + if (duplicate_loop_bodies(impl, resume_instr)) { nir_validate_shader(shader, "after duplicate_loop_bodies in " "nir_lower_shader_calls");