From 6b385bf6ad2a9c0f58406db8a3e6974c76c6f64b Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 14 Apr 2021 16:02:00 +0100 Subject: [PATCH] aco/ra: use original names when renaming loop carried phi operands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Fixes: 7c64623e948 ("aco/ra: refactor SSA repairing during register allocation") Part-of: (cherry picked from commit 11fde1247c291f836b28ad57984104a038e5cc51) --- .pick_status.json | 2 +- src/amd/compiler/aco_register_allocation.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 2b9ca4b3334..84e6df4907e 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1579,7 +1579,7 @@ "description": "aco/ra: use original names when renaming loop carried phi operands", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "7c64623e9489a37297808f7346e6e80bd1c78587" } diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 81448b940ca..4d6d683b902 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -1869,7 +1869,13 @@ void handle_loop_phis(ra_ctx& ctx, const IDSet& live_in, if (!op.isTemp()) continue; - op.setTemp(read_variable(ctx, op.getTemp(), preds[j])); + /* Find the original name, since this operand might not use the original name if the phi + * was created after init_reg_file(). + */ + std::unordered_map::iterator it = ctx.orig_names.find(op.tempId()); + Temp orig = it != ctx.orig_names.end() ? it->second : op.getTemp(); + + op.setTemp(read_variable(ctx, orig, preds[j])); op.setFixed(ctx.assignments[op.tempId()].reg); } }