diff --git a/.pick_status.json b/.pick_status.json index 17c657c7025..bc03cb7e3c2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -715,7 +715,7 @@ "description": "aco: keep loop live-through variables spilled", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp index 94364bfa54e..7d3055e33e0 100644 --- a/src/amd/compiler/aco_spill.cpp +++ b/src/amd/compiler/aco_spill.cpp @@ -383,6 +383,20 @@ RegisterDemand init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_id } unsigned loop_end = i; + /* keep live-through spilled */ + for (std::pair> pair : ctx.next_use_distances_end[block_idx - 1]) { + if (pair.second.first < loop_end) + continue; + + Temp to_spill = pair.first; + auto it = ctx.spills_exit[block_idx - 1].find(to_spill); + if (it == ctx.spills_exit[block_idx - 1].end()) + continue; + + ctx.spills_entry[block_idx][to_spill] = it->second; + spilled_registers += to_spill; + } + /* select live-through vgpr variables */ while (new_demand.vgpr - spilled_registers.vgpr > ctx.target_pressure.vgpr) { unsigned distance = 0;