Module: Mesa Branch: main Commit: ab0ed4ff3f2eed6610597a0f0b42b8ca829790f9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab0ed4ff3f2eed6610597a0f0b42b8ca829790f9
Author: Connor Abbott <[email protected]> Date: Mon Jan 10 18:16:05 2022 +0100 ir3/ra: Sanitize parallel copy flags better For pcopies we only care about the register's type, i.e. whether its a half-register and whether it's an array (plus its size). Copying over other flags like IR3_REG_RELATIV just leads to sadness and validator assertions. Fixes: 0ffcb19b9d9 ("ir3: Rewrite register allocation") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14107> --- src/freedreno/ir3/ir3_ra.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c index 72fd22c9087..54e3fad1f4b 100644 --- a/src/freedreno/ir3/ir3_ra.c +++ b/src/freedreno/ir3/ir3_ra.c @@ -1357,7 +1357,8 @@ insert_parallel_copy_instr(struct ra_ctx *ctx, struct ir3_instruction *instr) struct ra_parallel_copy *entry = &ctx->parallel_copies[i]; struct ir3_register *reg = ir3_dst_create(pcopy, INVALID_REG, - entry->interval->interval.reg->flags & ~IR3_REG_SSA); + entry->interval->interval.reg->flags & + (IR3_REG_HALF | IR3_REG_ARRAY)); reg->size = entry->interval->interval.reg->size; reg->wrmask = entry->interval->interval.reg->wrmask; assign_reg(pcopy, reg, ra_interval_get_num(entry->interval)); @@ -1367,7 +1368,8 @@ insert_parallel_copy_instr(struct ra_ctx *ctx, struct ir3_instruction *instr) struct ra_parallel_copy *entry = &ctx->parallel_copies[i]; struct ir3_register *reg = ir3_src_create(pcopy, INVALID_REG, - entry->interval->interval.reg->flags & ~IR3_REG_SSA); + entry->interval->interval.reg->flags & + (IR3_REG_HALF | IR3_REG_ARRAY)); reg->size = entry->interval->interval.reg->size; reg->wrmask = entry->interval->interval.reg->wrmask; assign_reg(pcopy, reg, ra_physreg_to_num(entry->src, reg->flags)); @@ -1808,8 +1810,9 @@ insert_liveout_copy(struct ir3_block *block, physreg_t dst, physreg_t src, pcopy->dsts[pcopy->dsts_count++] = old_pcopy->dsts[i]; } - struct ir3_register *dst_reg = - ir3_dst_create(pcopy, INVALID_REG, reg->flags & ~IR3_REG_SSA); + unsigned flags = reg->flags & (IR3_REG_HALF | IR3_REG_ARRAY); + + struct ir3_register *dst_reg = ir3_dst_create(pcopy, INVALID_REG, flags); dst_reg->wrmask = reg->wrmask; dst_reg->size = reg->size; assign_reg(pcopy, dst_reg, ra_physreg_to_num(dst, reg->flags)); @@ -1818,8 +1821,7 @@ insert_liveout_copy(struct ir3_block *block, physreg_t dst, physreg_t src, pcopy->srcs[pcopy->srcs_count++] = old_pcopy->srcs[i]; } - struct ir3_register *src_reg = - ir3_src_create(pcopy, INVALID_REG, reg->flags & ~IR3_REG_SSA); + struct ir3_register *src_reg = ir3_src_create(pcopy, INVALID_REG, flags); src_reg->wrmask = reg->wrmask; src_reg->size = reg->size; assign_reg(pcopy, src_reg, ra_physreg_to_num(src, reg->flags));
