Mesa (master): freedreno/ir3/cp: properly handle already-folded RELATIV

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 16 21:14:02 UTC 2020


Module: Mesa
Branch: master
Commit: f35f711c71f30e226a9151a3cbce1bd70546a5fe
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f35f711c71f30e226a9151a3cbce1bd70546a5fe

Author: Rob Clark <robdclark at chromium.org>
Date:   Sun Jun  7 11:14:18 2020 -0700

freedreno/ir3/cp: properly handle already-folded RELATIV

In the `try_swap_mad_two_srcs()` case, valid_flags() gets called both
for the src that we want to try to fold, and for the other src that we
are trying to swap to make that possible.  It can happen in the 2nd case
that a RELATIV src has already been folded.  Since `ssa()` returns non-
null in both the `IR3_REG_SSA` and `IR3_REG_ARRAY` cases (in the later
case, it is the dependent array access that the current instruction
cannot be moved ahead of), we need to explicitly check that the src
reg we are looking at is still an SSA src.

Reported-by: Jonathan Marek <jonathan at marek.ca>
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5280>

---

 src/freedreno/ir3/ir3_cp.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c
index 052c8a539ac..b95827e97e9 100644
--- a/src/freedreno/ir3/ir3_cp.c
+++ b/src/freedreno/ir3/ir3_cp.c
@@ -143,9 +143,11 @@ static bool valid_flags(struct ir3_instruction *instr, unsigned n,
 		 * called on a src that has already had an indirect load folded
 		 * in, in which case ssa() returns NULL
 		 */
-		struct ir3_instruction *src = ssa(instr->regs[n+1]);
-		if (src && src->address->block != instr->block)
-			return false;
+		if (instr->regs[n+1]->flags & IR3_REG_SSA) {
+			struct ir3_instruction *src = ssa(instr->regs[n+1]);
+			if (src->address->block != instr->block)
+				return false;
+		}
 	}
 
 	switch (opc_cat(instr->opc)) {



More information about the mesa-commit mailing list