diff options
author | Konstantin Seurer <konstantin.seurer@gmail.com> | 2023-05-13 19:35:14 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2023-05-16 18:24:17 +0000 |
commit | 40653f078390639e75cb7a9e616a3bcc8a45e959 (patch) | |
tree | 31cb806e9dfd680c9fcd77edc2c6fb468712bfb9 | |
parent | c0a3954538606ee6ee2e2cee183694f46e452826 (diff) | |
download | mesa-40653f078390639e75cb7a9e616a3bcc8a45e959.tar.gz |
nir/lower_shader_calls: Remat derefs earlier
spill_ssa_defs_and_lower_shader_calls can insert phis as well which can
make nir_opt_shrink_stores crash.
Fixes: 200e551c ("nir/lower_shader_calls: Remat derefs before lowering resumes")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9003
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23007>
-rw-r--r-- | src/compiler/nir/nir_lower_shader_calls.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/compiler/nir/nir_lower_shader_calls.c b/src/compiler/nir/nir_lower_shader_calls.c index 0c1c28810a8..e93a50c11ed 100644 --- a/src/compiler/nir/nir_lower_shader_calls.c +++ b/src/compiler/nir/nir_lower_shader_calls.c @@ -1179,13 +1179,6 @@ 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"); @@ -1941,6 +1934,13 @@ nir_lower_shader_calls(nir_shader *shader, NIR_PASS(progress, shader, nir_opt_cse); } + /* 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); + /* Save the start point of the call stack in scratch */ unsigned start_call_scratch = shader->scratch_size; |