agx: don't leak shuffle copies

==42579==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 9408 byte(s) in 147 object(s) allocated from:
    #0 0xffff244c4828 in __interceptor_realloc.part.0 (/usr/lib64/libasan.so.8.0.0+0xc4828) (BuildId: 3109905b64795755dad05d7bb29ad23633a06660)
    #1 0xffff1fc71fe0 in util_dynarray_ensure_cap ../src/util/u_dynarray.h:109
    #2 0xffff1fc71fe0 in util_dynarray_grow_bytes ../src/util/u_dynarray.h:157
    #3 0xffff1fc71fe0 in assign_regs_by_copying ../src/asahi/compiler/agx_register_allocate.c:440
    #4 0xffff1fc73858 in find_regs ../src/asahi/compiler/agx_register_allocate.c:648
    #5 0xffff1fc77d3c in pick_regs ../src/asahi/compiler/agx_register_allocate.c:1010
    #6 0xffff1fc77d3c in agx_ra_assign_local ../src/asahi/compiler/agx_register_allocate.c:1098
    #7 0xffff1fc77d3c in agx_ra ../src/asahi/compiler/agx_register_allocate.c:1355
    #8 0xffff1fc3b6c4 in agx_compile_function_nir ../src/asahi/compiler/agx_compile.c:2840

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28483>
This commit is contained in:
Alyssa Rosenzweig 2024-02-22 18:01:44 -04:00 committed by Marge Bot
parent 106da137e3
commit 645f5187ed

View file

@ -602,6 +602,8 @@ find_regs(struct ra_ctx *rctx, agx_instr *I, unsigned dest_idx, unsigned count,
util_dynarray_num_elements(&copies, struct agx_copy));
}
util_dynarray_fini(&copies);
/* assign_regs asserts this is cleared, so clear to be reassigned */
BITSET_CLEAR_RANGE(rctx->used_regs[cls], reg, reg + count - 1);
return reg;