summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimur Kristóf <timur.kristof@gmail.com>2020-11-18 21:28:09 +0100
committerDylan Baker <dylan.c.baker@intel.com>2020-12-01 11:25:26 -0800
commitbfc05f365cd8d9bf70a68344d91225b34aa85a0d (patch)
tree4ef2c83db27c616528cd886e351fb0677b1097c1
parent2a74f0ceb6066e7d8b3fb6537467e39a06c4b78e (diff)
aco/optimizer: Only set scc_needed when it is actually needed.
Not every p_cbranch uses the SCC, but our optimizer thought so. Fixes: 8a32f57fff56b3b94f1b5589feba38016f39427c Signed-off-by: Timur Kristóf <timur.kristof@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7677> (cherry picked from commit 8bd3fefb74bb731d509f971cc89c687a0fd99feb)
-rw-r--r--.pick_status.json2
-rw-r--r--src/amd/compiler/aco_optimizer.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json
index fbf7a6a6280..e7f157e400c 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1930,7 +1930,7 @@
"description": "aco/optimizer: Only set scc_needed when it is actually needed.",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "8a32f57fff56b3b94f1b5589feba38016f39427c"
},
diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 5c7bf2ae5cd..bbb6a4ce00f 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -2986,7 +2986,9 @@ void select_instruction(opt_ctx &ctx, aco_ptr<Instruction>& instr)
/* Mark SCC needed, so the uniform boolean transformation won't swap the definitions when it isn't beneficial */
if (instr->format == Format::PSEUDO_BRANCH &&
instr->operands.size() &&
- instr->operands[0].isTemp()) {
+ instr->operands[0].isTemp() &&
+ instr->operands[0].isFixed() &&
+ instr->operands[0].physReg() == scc) {
ctx.info[instr->operands[0].tempId()].set_scc_needed();
return;
} else if ((instr->opcode == aco_opcode::s_cselect_b64 ||