Mesa (staging/21.3): freedreno/ir3: Handle instr->address when cloning

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 23 22:57:40 UTC 2021


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Wed Dec  1 17:06:20 2021 -0800

freedreno/ir3: Handle instr->address when cloning

Without this, a cloned instruction that takes full regs will trigger an
ir3_validate assert.  This can happen, for ex, if an instruction that
writes p0.x and has a relative src gets cloned in ir3_sched.

Fixes an assert in Genshin Impact with a debug build.

Fixes: 9af795d9b98 ("ir3: Make ir3_instruction::address a normal register")
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14231>
(cherry picked from commit 78c53f48888bf936d41e16b8bcf020beb5c5ff99)

---

 .pick_status.json       | 2 +-
 src/freedreno/ir3/ir3.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 88b9961a87a..c7aea0f28e6 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -580,7 +580,7 @@
         "description": "freedreno/ir3: Handle instr->address when cloning",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "9af795d9b984055042ef4ed33c6d3f2021be778a"
     },
diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c
index e5750827304..83236811390 100644
--- a/src/freedreno/ir3/ir3.c
+++ b/src/freedreno/ir3/ir3.c
@@ -490,6 +490,11 @@ ir3_instr_clone(struct ir3_instruction *instr)
       *new_reg = *reg;
    }
 
+   if (instr->address) {
+      assert(instr->srcs_count > 0);
+      new_instr->address = new_instr->srcs[instr->srcs_count - 1];
+   }
+
    return new_instr;
 }
 



More information about the mesa-commit mailing list