ir3/ra: Reinitialize interval when inserting

Otherwise when an interval is removed and then re-inserted it could
have an invalid/corrupted parent link and child tree. I think RA
happened to never do this, but spilling will.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>
This commit is contained in:
Connor Abbott 2021-07-23 11:50:46 +02:00 committed by Marge Bot
parent 4b0eba9cb1
commit eae36b4850
1 changed files with 12 additions and 1 deletions

View File

@ -175,6 +175,17 @@ void
ir3_reg_interval_insert(struct ir3_reg_ctx *ctx,
struct ir3_reg_interval *interval)
{
rb_tree_init(&interval->children);
interval->parent = NULL;
interval_insert(ctx, &ctx->intervals, interval);
}
/* Call after ir3_reg_interval_remove_temp() to reinsert the interval */
static void
ir3_reg_interval_reinsert(struct ir3_reg_ctx *ctx,
struct ir3_reg_interval *interval)
{
interval->parent = NULL;
interval_insert(ctx, &ctx->intervals, interval);
}
@ -669,7 +680,7 @@ ra_push_interval(struct ra_ctx *ctx, struct ra_file *file,
interval->physreg_start = dst;
interval->physreg_end = dst + removed->size;
ir3_reg_interval_insert(&file->reg_ctx, &interval->interval);
ir3_reg_interval_reinsert(&file->reg_ctx, &interval->interval);
}
/* Pick up the interval and place it at "dst". */