freedreno/ir3/cp: properly handle already-folded RELATIV
authorRob Clark <robdclark@chromium.org>
Sun, 7 Jun 2020 18:14:18 +0000 (11:14 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 16 Jun 2020 20:56:15 +0000 (20:56 +0000)
commitf35f711c71f30e226a9151a3cbce1bd70546a5fe
tree905e31f8510219b6ed9e41618a41c654ffc3579a
parent1bee79996b215be271b6dd76d145e3c5bb55af3f
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@marek.ca>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5280>
src/freedreno/ir3/ir3_cp.c