nir/lower_shader_calls: Remove phis after dead control flow
authorFriedrich Vock <friedrich.vock@gmx.de>
Thu, 8 Dec 2022 20:37:06 +0000 (21:37 +0100)
committerMarge Bot <emma+marge@anholt.net>
Sun, 11 Dec 2022 22:13:32 +0000 (22:13 +0000)
This potentially gets rid of some more phis without sources.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19960>

src/compiler/nir/nir_lower_shader_calls.c

index eba34ec..02c8478 100644 (file)
@@ -1968,11 +1968,11 @@ nir_lower_shader_calls(nir_shader *shader,
    for (unsigned i = 0; i < num_calls; i++) {
       nir_instr *resume_instr = lower_resume(resume_shaders[i], i);
       replace_resume_with_halt(resume_shaders[i], resume_instr);
-      nir_opt_remove_phis(resume_shaders[i]);
       /* Remove the dummy blocks added by flatten_resume_if_ladder() */
       nir_opt_if(resume_shaders[i], nir_opt_if_optimize_phi_true_false);
       nir_opt_dce(resume_shaders[i]);
       nir_opt_dead_cf(resume_shaders[i]);
+      nir_opt_remove_phis(resume_shaders[i]);
    }
 
    for (unsigned i = 0; i < num_calls; i++)