Mesa (staging/19.3): aco: fix invalid access on Pseudo_instructions
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Nov 13 18:33:33 UTC 2019
Module: Mesa
Branch: staging/19.3
Commit: b3033a0a4f06128fcf77dd0fce240550ef6f2f32
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3033a0a4f06128fcf77dd0fce240550ef6f2f32
Author: Daniel Schürmann <daniel at schuermann.dev>
Date: Fri Nov 8 16:36:11 2019 +0100
aco: fix invalid access on Pseudo_instructions
Fixes: 93c8ebfa780ebd1495095e794731881aef29e7d3 aco: Initial commit of independent AMD compiler
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
(cherry picked from commit a2a6880743d7370a6425593f22d9e98317bfc3b2)
---
src/amd/compiler/aco_register_allocation.cpp | 10 +++++++++-
src/amd/compiler/aco_spill.cpp | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp
index 9e3d796dc2f..3b4100cddd2 100644
--- a/src/amd/compiler/aco_register_allocation.cpp
+++ b/src/amd/compiler/aco_register_allocation.cpp
@@ -881,7 +881,15 @@ void handle_pseudo(ra_ctx& ctx,
break;
}
}
- if (!writes_sgpr)
+ /* if all operands are constant, no need to care either */
+ bool reads_sgpr = false;
+ for (Operand& op : instr->operands) {
+ if (op.isTemp() && op.getTemp().type() == RegType::sgpr) {
+ reads_sgpr = true;
+ break;
+ }
+ }
+ if (!(writes_sgpr && reads_sgpr))
return;
Pseudo_instruction *pi = (Pseudo_instruction *)instr;
diff --git a/src/amd/compiler/aco_spill.cpp b/src/amd/compiler/aco_spill.cpp
index 276dcbd7c5b..952094f40d0 100644
--- a/src/amd/compiler/aco_spill.cpp
+++ b/src/amd/compiler/aco_spill.cpp
@@ -265,7 +265,7 @@ aco_ptr<Instruction> do_reload(spill_ctx& ctx, Temp tmp, Temp new_name, uint32_t
} else if (instr->format == Format::SOP1) {
res.reset(create_instruction<SOP1_instruction>(instr->opcode, instr->format, instr->operands.size(), instr->definitions.size()));
} else if (instr->format == Format::PSEUDO) {
- res.reset(create_instruction<Instruction>(instr->opcode, instr->format, instr->operands.size(), instr->definitions.size()));
+ res.reset(create_instruction<Pseudo_instruction>(instr->opcode, instr->format, instr->operands.size(), instr->definitions.size()));
}
for (unsigned i = 0; i < instr->operands.size(); i++) {
res->operands[i] = instr->operands[i];
More information about the mesa-commit
mailing list