summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schürmann <daniel@schuermann.dev>2020-12-15 16:21:12 +0100
committerDylan Baker <dylan.c.baker@intel.com>2020-12-17 13:21:37 -0800
commit8217078f007fb2cda2d82b0b904fbf3e80b9047c (patch)
tree38d546c0591ee37393517f685ce5b51046a030b3
parent59a94717ff06a4058ce5a4e3ee0c6b3e2ae8b59a (diff)
aco/ra: fix phi operand renaming
In case one operand was renamed and another operand came from an incomplete phi, it could happen, that the original name was not restored. This has no impact on the code, but ensures correct SSA is maintained during RA. Cc: mesa-stable Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8109> (cherry picked from commit b50d3e5760ca8af775357b4176aaac5991f93cf0)
-rw-r--r--.pick_status.json2
-rw-r--r--src/amd/compiler/aco_register_allocation.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index fec41f539a0..7f885dcfd33 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -130,7 +130,7 @@
"description": "aco/ra: fix phi operand renaming",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": null
},
diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 3cf0153c583..c2215da8fc3 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -1637,6 +1637,11 @@ Temp handle_live_in(ra_ctx& ctx, Temp val, Block* block)
phi->operands[i].setFixed(ctx.assignments[ops[i].id()].reg);
if (ops[i].regClass() == new_val.regClass())
ctx.affinities[new_val.id()] = ops[i].id();
+ /* make sure the operand gets it's original name in case
+ * it comes from an incomplete phi */
+ std::unordered_map<unsigned, phi_info>::iterator it = ctx.phi_map.find(ops[i].id());
+ if (it != ctx.phi_map.end())
+ it->second.uses.emplace(phi.get());
}
ctx.assignments.emplace_back();
assert(ctx.assignments.size() == ctx.program->peekAllocationId());