Mesa (master): aco: clear operands in update_renames()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 4 21:20:31 UTC 2020


Module: Mesa
Branch: master
Commit: 67860b99ce57e6df8e7e150f3c2eb13dc0754574
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=67860b99ce57e6df8e7e150f3c2eb13dc0754574

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue Nov 17 15:27:06 2020 +0000

aco: clear operands in update_renames()

In the future, they might not have already been cleared.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7656>

---

 src/amd/compiler/aco_register_allocation.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index cadf2ce2e93..7d942d677fa 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -552,6 +552,14 @@ void update_renames(ra_ctx& ctx, RegisterFile& reg_file,
                     std::vector<std::pair<Operand, Definition>>& parallelcopies,
                     aco_ptr<Instruction>& instr, bool rename_not_killed_ops)
 {
+   /* clear operands */
+   for (std::pair<Operand, Definition>& copy : parallelcopies) {
+      /* the definitions with id are not from this function and already handled */
+      if (copy.second.isTemp())
+         continue;
+      reg_file.clear(copy.first);
+   }
+
    /* allocate id's and rename operands: this is done transparently here */
    for (std::pair<Operand, Definition>& copy : parallelcopies) {
       /* the definitions with id are not from this function and already handled */
@@ -1555,7 +1563,6 @@ void get_reg_for_operand(ra_ctx& ctx, RegisterFile& register_file,
          /* find free reg */
          PhysReg reg = get_reg(ctx, register_file, pc_op.getTemp(), parallelcopy, ctx.pseudo_dummy);
          Definition pc_def = Definition(PhysReg{reg}, pc_op.regClass());
-         register_file.clear(pc_op);
          parallelcopy.emplace_back(pc_op, pc_def);
       }
       dst = operand.physReg();
@@ -1567,7 +1574,6 @@ void get_reg_for_operand(ra_ctx& ctx, RegisterFile& register_file,
    Operand pc_op = operand;
    pc_op.setFixed(ctx.assignments[operand.tempId()].reg);
    Definition pc_def = Definition(dst, pc_op.regClass());
-   register_file.clear(pc_op);
    parallelcopy.emplace_back(pc_op, pc_def);
    update_renames(ctx, register_file, parallelcopy, instr, true);
 }



More information about the mesa-commit mailing list