ir3: run opt_if after opt_vectorize
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

nir_opt_vectorize could replace swizzled movs with vectorized movs in a
different block. If this happens with swizzled movs in a then block, it
could leave this block empty. ir3 assumes only the else block can be
empty (e.g., when lowering predicates) so make sure ifs are in that
canonical form again.

This fixes empty predication blocks in some shaders, for example:

predt
predf
...
prede

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34272>
This commit is contained in:
Job Noorman 2025-03-29 09:51:49 +01:00 committed by Marge Bot
parent ee0ee2a317
commit 02ff26be38

View file

@ -120,6 +120,14 @@ ir3_context_init(struct ir3_compiler *compiler, struct ir3_shader *shader,
NIR_PASS(_, ctx->s, nir_opt_undef);
NIR_PASS(_, ctx->s, nir_copy_prop);
NIR_PASS(_, ctx->s, nir_opt_dce);
/* nir_opt_vectorize could replace swizzled movs with vectorized movs in a
* different block. If this happens with swizzled movs in a then block, it
* could leave this block empty. ir3 assumes only the else block can be
* empty (e.g., when lowering predicates) so make sure ifs are in that
* canonical form again.
*/
NIR_PASS(_, ctx->s, nir_opt_if, 0);
}
NIR_PASS(progress, ctx->s, nir_convert_to_lcssa, true, true);