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 <jiajia.qian@nxp.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39773>
This commit is contained in:
jiajia Qian 2026-02-10 14:58:52 +08:00 committed by Marge Bot
parent d42268f3e5
commit f16d17a454

View file

@ -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