nir: Allow derefs to be used as phi sources

It is possible and valid for a pointer to be selected based on a
conditional before used, and depending on the mode, those cases will
result in a phi with derefs as sources.

To achieve this, we don't rematerialize derefs that are used by phis.
As a consequence, when converting from SSA to regs, we may have phis
that come from different blocks and are used by phis.  We now convert
those to regs too.

Validation was added to ensure only derefs of certain modes can be
used as phi sources.  No extra validation is needed for the presence
of cast, any instruction that uses derefs will validate the
deref-chain is complete (ending in a cast or a var).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
10 jobs for !823 with r/nir-phis-with-derefs-srcs in 9 minutes and 24 seconds (queued for 1 second)
detached
Status Name Job ID Coverage
  Containers Build
passed debian #324753

00:00:28

 
  Build+Test
passed meson-clang #324755

00:08:54

passed meson-clover #324759

00:07:21

passed meson-main #324758

00:04:20

passed meson-swr-glvnd #324754

00:04:01

passed meson-vulkan #324760

00:02:39

passed scons-llvm #324762

00:04:26

passed scons-nollvm #324761

00:03:16

passed scons-swr #324756

00:03:49

passed scons-win64 #324757

00:04:31