nir_to_tgsi: run constant folding after nir_opt_algebraic
Otherwise, an infinite loop can occur. The first nir_opt_algebraic in the loop can optimize: op(bcsel(a, #b, c), #d) to bcsel(a, op(b, d), op(c, d)) which (because op(b, d) is not constant folded), will be reverted by the second nir_opt_algebraic in the loop. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Neha Bhende <bhenden@vmware.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10071>
This commit is contained in:
@@ -2411,6 +2411,7 @@ ntt_optimize_nir(struct nir_shader *s, struct pipe_screen *screen)
|
||||
|
||||
NIR_PASS(progress, s, nir_copy_prop);
|
||||
NIR_PASS(progress, s, nir_opt_algebraic);
|
||||
NIR_PASS(progress, s, nir_opt_constant_folding);
|
||||
NIR_PASS(progress, s, nir_opt_remove_phis);
|
||||
NIR_PASS(progress, s, nir_opt_conditional_discard);
|
||||
NIR_PASS(progress, s, nir_opt_dce);
|
||||
|
||||
Reference in New Issue
Block a user