agx: Remove identity moves

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16268>
This commit is contained in:
Alyssa Rosenzweig 2022-04-18 18:34:14 -04:00
parent c712043b9c
commit 4498799822
1 changed files with 8 additions and 0 deletions

View File

@ -379,6 +379,14 @@ agx_ra(agx_context *ctx)
agx_foreach_instr_global_safe(ctx, I) {
if (I->op == AGX_OPCODE_PHI || I->op == AGX_OPCODE_P_LOGICAL_END)
agx_remove_instruction(I);
/* Remove identity moves */
if (I->op == AGX_OPCODE_MOV && I->src[0].type == AGX_INDEX_REGISTER &&
I->dest[0].size == I->src[0].size && I->src[0].value == I->dest[0].value) {
assert(I->dest[0].type == AGX_INDEX_REGISTER);
agx_remove_instruction(I);
}
}
free(ssa_to_reg);