Skip to content

WIP: nir/opt_if: Transform phis of empty if/else blocks to use undef + ALU.

Timur Kristóf requested to merge Venemo/mesa:nir_collapse_bool_phis into main

Find phi instructions after an if-else where either if or else block is empty. Change the phi to use undef for the empty block and add ALU instructions to get the original value.

This helps backends that control SIMD lanes explicitly (eg. ACO) because they won't have to emit instructions for the empty block.

There is also a commit which takes the new option into use by RADV and ac_nir_lower_ngg (for culling shaders, they benefit from this).

Edited by Timur Kristóf

Merge request reports