Mesa (main): aco: properly update use counts if a extract is still used
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Nov 29 19:13:20 UTC 2021
Module: Mesa
Branch: main
Commit: 65a78b2252cb4b4b08e24717752f5e2ba139cf45
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=65a78b2252cb4b4b08e24717752f5e2ba139cf45
Author: Rhys Perry <pendingchaos02 at gmail.com>
Date: Mon Nov 22 11:03:03 2021 +0000
aco: properly update use counts if a extract is still used
Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13909>
---
src/amd/compiler/aco_optimizer.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 29ca5105691..5727150a25d 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -3258,8 +3258,10 @@ combine_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
(info.instr->operands[0].getTemp().type() == RegType::vgpr ||
instr->operands[i].getTemp().type() == RegType::sgpr) &&
can_apply_extract(ctx, instr, i, info)) {
+ /* Increase use count of the extract's operand if the extract still has uses. */
apply_extract(ctx, instr, i, info);
- ctx.uses[instr->operands[i].tempId()]--;
+ if (--ctx.uses[instr->operands[i].tempId()])
+ ctx.uses[info.instr->operands[0].tempId()]++;
instr->operands[i].setTemp(info.instr->operands[0].getTemp());
}
}
More information about the mesa-commit
mailing list