agx: Peephole select after opt_preamble

Reduces control flow in Dolphin uber shaders, which saves us a few cycles.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20597>
This commit is contained in:
Alyssa Rosenzweig
2022-12-29 18:04:40 -05:00
committed by Marge Bot
parent f4b3201244
commit 61c7e1bf48

View File

@@ -1702,6 +1702,14 @@ agx_optimize_nir(nir_shader *nir, unsigned *preamble_size)
NIR_PASS_V(nir, nir_lower_int64);
NIR_PASS_V(nir, agx_nir_opt_preamble, preamble_size);
/* Forming preambles may dramatically reduce the instruction count
* in certain blocks, causing some if-else statements to become
* trivial. We want to peephole select those, given that control flow
* prediction instructions are costly.
*/
NIR_PASS_V(nir, nir_opt_peephole_select, 64, false, true);
NIR_PASS_V(nir, nir_opt_algebraic_late);
NIR_PASS_V(nir, nir_opt_constant_folding);