agx/lower_address: Use intrinsics_pass
authorChristian Gmeiner <cgmeiner@igalia.com>
Thu, 24 Aug 2023 09:01:10 +0000 (11:01 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 5 Sep 2023 18:50:34 +0000 (18:50 +0000)
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>

src/asahi/compiler/agx_nir_lower_address.c

index 0ac0a56..bd72ded 100644 (file)
@@ -253,12 +253,8 @@ format_for_bitsize(unsigned bitsize)
 }
 
 static bool
-pass(struct nir_builder *b, nir_instr *instr, UNUSED void *data)
+pass(struct nir_builder *b, nir_intrinsic_instr *intr, void *data)
 {
-   if (instr->type != nir_instr_type_intrinsic)
-      return false;
-
-   nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
    if (intr->intrinsic != nir_intrinsic_load_global &&
        intr->intrinsic != nir_intrinsic_load_global_constant &&
        intr->intrinsic != nir_intrinsic_global_atomic &&
@@ -266,7 +262,7 @@ pass(struct nir_builder *b, nir_instr *instr, UNUSED void *data)
        intr->intrinsic != nir_intrinsic_store_global)
       return false;
 
-   b->cursor = nir_before_instr(instr);
+   b->cursor = nir_before_instr(&intr->instr);
 
    unsigned bitsize = intr->intrinsic == nir_intrinsic_store_global
                          ? nir_src_bit_size(intr->src[0])
@@ -346,13 +342,13 @@ pass(struct nir_builder *b, nir_instr *instr, UNUSED void *data)
    if (repl)
       nir_def_rewrite_uses(&intr->def, repl);
 
-   nir_instr_remove(instr);
+   nir_instr_remove(&intr->instr);
    return true;
 }
 
 bool
 agx_nir_lower_address(nir_shader *shader)
 {
-   return nir_shader_instructions_pass(
+   return nir_shader_intrinsics_pass(
       shader, pass, nir_metadata_block_index | nir_metadata_dominance, NULL);
 }