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); } }