mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
radv: immediately remove phis after loop unrolling
Loop unrolling can create phis when constants are defined in the loop but used outside of it. Ideally this should not happen, but for now we have to remove these as soon as possible before they trip up other passes. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40928>
This commit is contained in:
parent
7e163fb793
commit
4598bbaea7
1 changed files with 9 additions and 1 deletions
|
|
@ -222,7 +222,15 @@ radv_optimize_nir(struct nir_shader *shader, bool optimize_conservatively)
|
|||
NIR_LOOP_PASS(progress, skip, shader, nir_opt_undef);
|
||||
|
||||
if (shader->options->max_unroll_iterations) {
|
||||
NIR_LOOP_PASS_NOT_IDEMPOTENT(progress, skip, shader, nir_opt_loop_unroll);
|
||||
bool unroll_progess = false;
|
||||
NIR_LOOP_PASS_NOT_IDEMPOTENT(unroll_progess, skip, shader, nir_opt_loop_unroll);
|
||||
/* Loop unrolling can add trivial phis for constants defined in the loop,
|
||||
* which can break all kinds of validation if they aren't removed immediately.
|
||||
*/
|
||||
if (unroll_progess) {
|
||||
progress = true;
|
||||
NIR_LOOP_PASS(progress, skip, shader, nir_opt_remove_phis);
|
||||
}
|
||||
}
|
||||
} while (progress && !optimize_conservatively);
|
||||
_mesa_set_destroy(skip, NULL);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue