aco/spill: Fix assertion for nested loops

Fixes: 898fd9227a ('aco/spill: keep loop variables spilled during nested loops')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27799>
This commit is contained in:
Daniel Schürmann 2024-03-25 18:08:29 +01:00 committed by Marge Bot
parent c38a2ab993
commit 66616f0862

View file

@ -535,9 +535,11 @@ init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_idx)
if (!ctx.loop.empty()) {
/* If this is a nested loop, keep variables from the outer loop spilled. */
for (auto spilled : ctx.loop.back().spills) {
assert(next_use_distances.count(spilled.first));
if (ctx.spills_entry[block_idx].insert(spilled).second) {
/* If the inner loop comes after the last continue statement of the outer loop,
* the loop-carried variables might not be live-in for the inner loop.
*/
if (next_use_distances.count(spilled.first) &&
ctx.spills_entry[block_idx].insert(spilled).second) {
spilled_registers += spilled.first;
loop_demand -= spilled.first;
}