Skip to content

nir: optimize phi to scalar lowering for undefs

Job Noorman requested to merge jnoorman/mesa:ir3-phis-scalar-undef into main

When lowering phis to scalar, nir_lower_phis_to_scalar creates moves to extract components. This made it difficult to detect undefs in phi sources in the ir3 backend because they might be hiding behind a move. This MR simplifies this by creating new 1-component undefs 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

Merge request reports