From f16d17a45486ad2b5f071fdf40581f84401ceddc Mon Sep 17 00:00:00 2001 From: jiajia Qian Date: Tue, 10 Feb 2026 14:58:52 +0800 Subject: [PATCH] nir/opt_phi_precision: Fix bit size mismatch when moving widening conversions Add a check to ensure that when load_const can be narrowed, the bit size from other widening conversion sources must be 16-bit to maintain consistency across all phi sources. Signed-off-by: jiajia Qian Part-of: --- src/compiler/nir/nir_opt_phi_precision.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/compiler/nir/nir_opt_phi_precision.c b/src/compiler/nir/nir_opt_phi_precision.c index eb2e6eb3f88..ee668c1e381 100644 --- a/src/compiler/nir/nir_opt_phi_precision.c +++ b/src/compiler/nir/nir_opt_phi_precision.c @@ -338,6 +338,9 @@ find_widening_op(nir_phi_instr *phi, unsigned *bit_size) if ((op == INVALID_OP) || !has_load_const) return op; + if (*bit_size != 16) + return INVALID_OP; + /* If we could otherwise move widening sources, but load_const is * one of the phi sources (and does not have a widening conversion, * but could have a narrowing->widening sequence inserted without