diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 53965f2d105..4d5be6b184e 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -1082,7 +1082,7 @@ agx_emit_export(agx_builder *b, unsigned base, nir_src src) agx_export(&b_, chan, base + (c * stride)); } - if (memcmp(&b->cursor, &after_cursor, sizeof(agx_cursor)) == 0) { + if (agx_cursors_equal(b->cursor, after_cursor)) { b->cursor = agx_after_block_logical(b->cursor.block); } diff --git a/src/asahi/compiler/agx_compiler.h b/src/asahi/compiler/agx_compiler.h index 6fba5cb429d..c48897b73da 100644 --- a/src/asahi/compiler/agx_compiler.h +++ b/src/asahi/compiler/agx_compiler.h @@ -801,6 +801,18 @@ typedef struct { }; } agx_cursor; +static inline bool +agx_cursors_equal(agx_cursor a, agx_cursor b) +{ + if (a.option != b.option) + return false; + + if (a.option == agx_cursor_after_block) + return a.block == b.block; + else + return a.instr == b.instr; +} + static inline agx_cursor agx_after_block(agx_block *block) {