agx: Optimize logical_end removal

We know logical_end instructions are only at the end of the block (validated),
so by changing how we iterate the pass goes from O(instructions) to O(blocks)
which is strictly better.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24635>
This commit is contained in:
Alyssa Rosenzweig 2023-07-31 16:40:48 -04:00 committed by Marge Bot
parent d459de85b7
commit 135f3c35c5

View file

@ -984,9 +984,13 @@ agx_pack_binary(agx_context *ctx, struct util_dynarray *emission)
struct util_dynarray fixups;
util_dynarray_init(&fixups, ctx);
agx_foreach_instr_global_safe(ctx, I) {
if (I->op == AGX_OPCODE_LOGICAL_END)
agx_remove_instruction(I);
agx_foreach_block(ctx, block) {
agx_foreach_instr_in_block_rev(block, I) {
if (I->op == AGX_OPCODE_LOGICAL_END) {
agx_remove_instruction(I);
break;
}
}
}
agx_foreach_block(ctx, block) {