dxil: Use nir_foreach_phi_safe
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 11 May 2023 17:49:02 +0000 (13:49 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 12 May 2023 14:02:23 +0000 (14:02 +0000)
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>

src/microsoft/compiler/dxil_nir.c

index 175c55b..39abd52 100644 (file)
@@ -993,11 +993,7 @@ upcast_phi_impl(nir_function_impl *impl, unsigned min_bit_size)
    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 ||