From 37c88be5ea165f0e3f7149c056d10926952ccacb Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Tue, 27 Apr 2021 17:26:09 +0200 Subject: [PATCH] aco/spill: Fix improper handling of exec phis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "continue" was placed in the wrong loop, leading to exec being counted as a spilled register when it wasn't. Reviewed-by: Daniel Schürmann Fixes: a56ddca4e80a6ef7bb0c44edb4e5b6169510aaca ('aco: make all exec accesses non-temporaries') Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4533 Part-of: (cherry picked from commit 741e84f55479b6d373c6aa9b58615cd3feba3231) --- .pick_status.json | 2 +- src/amd/compiler/aco_spill.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index e0f14b11c5f..678362d1753 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -310,7 +310,7 @@ "description": "aco/spill: Fix improper handling of exec phis", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "a56ddca4e80a6ef7bb0c44edb4e5b6169510aaca" }, diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp index 5988b866eed..cc9960b25d6 100644 --- a/src/amd/compiler/aco_spill.cpp +++ b/src/amd/compiler/aco_spill.cpp @@ -606,12 +606,13 @@ RegisterDemand init_live_in_vars(spill_ctx& ctx, Block* block, unsigned block_id for (aco_ptr& phi : block->instructions) { if (!is_phi(phi)) break; + if (!phi->definitions[0].isTemp()) + continue; + std::vector& preds = phi->opcode == aco_opcode::p_phi ? block->logical_preds : block->linear_preds; bool spill = true; for (unsigned i = 0; i < phi->operands.size(); i++) { - if (!phi->definitions[0].isTemp()) - continue; /* non-temp operands can increase the register pressure */ if (!phi->operands[i].isTemp()) { partial_spills.insert(phi->definitions[0].getTemp());