diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c index 1d8b81c0002..a282b033c5d 100644 --- a/src/freedreno/ir3/ir3_ra.c +++ b/src/freedreno/ir3/ir3_ra.c @@ -780,10 +780,12 @@ try_evict_regs(struct ra_ctx *ctx, struct ra_file *file, return false; } + unsigned conflicting_file_size = + reg_file_size(file, conflicting->interval.reg); unsigned avail_start, avail_end; bool evicted = false; BITSET_FOREACH_RANGE (avail_start, avail_end, available_to_evict, - reg_file_size(file, conflicting->interval.reg)) { + conflicting_file_size) { unsigned size = avail_end - avail_start; /* non-half registers must be aligned */ @@ -820,6 +822,10 @@ try_evict_regs(struct ra_ctx *ctx, struct ra_file *file, conflicting->physreg_end - conflicting->physreg_start) continue; + if (killed->physreg_end > conflicting_file_size || + conflicting->physreg_end > reg_file_size(file, killed->interval.reg)) + continue; + /* We can't swap the killed range if it partially/fully overlaps the * space we're trying to allocate or (in speculative mode) if it's * already been swapped and will overlap when we actually evict.