Module: Mesa
Branch: staging/20.2
Commit: bfc05f365cd8d9bf70a68344d91225b34aa85a0d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bfc05f365cd8d9bf70a68344d91225b34aa85a0d

Author: Timur Kristóf <[email protected]>
Date:   Wed Nov 18 21:28:09 2020 +0100

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 <[email protected]>
Reviewed-by: Daniel Schürmann <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7677>
(cherry picked from commit 8bd3fefb74bb731d509f971cc89c687a0fd99feb)

---

 .pick_status.json                  | 2 +-
 src/amd/compiler/aco_optimizer.cpp | 4 +++-
 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 ||

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to