diff --git a/src/freedreno/ir3/ir3_context.c b/src/freedreno/ir3/ir3_context.c index 54f2d72717e..a590749a8a6 100644 --- a/src/freedreno/ir3/ir3_context.c +++ b/src/freedreno/ir3/ir3_context.c @@ -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);