nir/validate: Don't abort() until after the shader has printed
authorJason Ekstrand <jason@jlekstrand.net>
Wed, 8 Jul 2020 16:56:32 +0000 (11:56 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 8 Jul 2020 19:51:58 +0000 (19:51 +0000)
commit29cba3b6954dc26ada9b5797be289f9617728974
tree3447bbf70916c0248c618eeb649e3f237d3cb36e
parent55cf97f56edbfbaaff646131fc9e1299b38af355
nir/validate: Don't abort() until after the shader has printed

In the case where SSA use/def chains are broken, NIR prints out a very
cryptic error and then aborts.  This abort happens during validation
rather than after the print is complete, hiding any other errors that
may have been found.  One might think, "So what?  Fix your use/def issue
first."  However, what makes this especially bad is that, when use/def
chains are broken, there's usually a much nicer error inline in the
shader that would have been printed had we not aborted early so the
current behavior simply ensures you get the most cryptic error possible
in an already difficult-to-debug case.

While we're at it, we remove the one other case of abort() which is in
the validation of phi instruction sources.

Reviewed-by: Rob Clark <robclark@freedesktop.org>
Tested-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5809>
src/compiler/nir/nir_validate.c