nir: optimize phi to scalar lowering for undefs
When lowering phis to scalar, nir_lower_phis_to_scalar
creates moves to extract components. This made it difficult to detect undef
s in phi sources in the ir3 backend because they might be hiding behind a move. This MR simplifies this by creating new 1-component undef
s instead of moving out of the original one.
Since I needed a nir_builder
to use nir_undef
, and nir_lower_phis_to_scalar
wasn't using this API yet, this MR also refactors it to use nir_builder
where possible.
This MR gets rid of the useless moves notices in !29860.
Edited by Job Noorman