Module: Mesa Branch: main Commit: f4b3201244d11e118fd09aac557b907bcdc88ff3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4b3201244d11e118fd09aac557b907bcdc88ff3
Author: Alyssa Rosenzweig <[email protected]> Date: Mon Jan 9 22:10:56 2023 -0500 nir/peephole_select: Allow load_preamble load_preamble is intended to be almost free (costing at most a move), and it does not have special bounds checking requirement, so it's ok to select with it. With this, drivers that use nir_opt_preamble together with a late call to peephole_select can optimize sequences like: if (x) { <uniform-on-uniform calculation> } else { <different uniform-on-uniform calculation> } to simply bcsel(x, <uniform register 0>, <uniform register 1>) rather than emitting needless control flow / branching over some moves. Signed-off-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20597> --- src/compiler/nir/nir_opt_peephole_select.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c index 03d656dd8eb..f9701e300f6 100644 --- a/src/compiler/nir/nir_opt_peephole_select.c +++ b/src/compiler/nir/nir_opt_peephole_select.c @@ -121,6 +121,7 @@ block_check_for_allowed_instrs(nir_block *block, unsigned *count, } case nir_intrinsic_load_uniform: + case nir_intrinsic_load_preamble: case nir_intrinsic_load_helper_invocation: case nir_intrinsic_is_helper_invocation: case nir_intrinsic_load_front_face:
