This should be faster, since we're not iterating pointlessly over all the
non-phis after the phi.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22967>
bool progress = false;
nir_foreach_block_reverse(block, impl) {
- nir_foreach_instr_safe(instr, block) {
- if (instr->type != nir_instr_type_phi)
- continue;
-
- nir_phi_instr *phi = nir_instr_as_phi(instr);
+ nir_foreach_phi_safe(phi, block) {
assert(phi->dest.is_ssa);
if (phi->dest.ssa.bit_size == 1 ||