pan/mdg: Test for SSA before chasing addresses
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 31 Jul 2020 14:43:55 +0000 (10:43 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 3 Aug 2020 13:43:47 +0000 (09:43 -0400)
commitb2f475251ed9fa8b37cb98372e64d6166d48a089
treea393412db688d3fda3f1b382ada0405c6337eed4
parentb4de9e035ac0afe64ebfd58cd0eb04c1a671afce
pan/mdg: Test for SSA before chasing addresses

It's possible an SSA value depends on a register; in this case, chasing
the source would result in a crash as the chase helper in NIR asserts
is_ssa. Instead we should check a priori that all the argments are in
fact SSA, bailing otherwise.

In the piglit shader exhibiting this bug (by looping over the index),
bailing on the ishl instruction is -necessary-. This is not merely us
being cowardly to avoid seeing through the registers; indeed, if we
wrote away the ishl instruction, the shift itself would have to be
stored in a load/store register (r26/r27) which would preclude reading
it in the loop, creating a register allocation failure later in the
compile. So this is the correct solution due to the restricted
semantics.

Closes #3286

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reported-by: Icecream95 <ixn@keemail.me>
Fixes: f5401cb8866 ("pan/midgard: Add address analysis framework")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6144>
src/panfrost/midgard/midgard_address.c