nir/validate: Improve the validation of blocks
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 15 Sep 2020 16:28:43 +0000 (11:28 -0500)
committerMarge Bot <eric+marge@anholt.net>
Wed, 30 Sep 2020 16:46:11 +0000 (16:46 +0000)
commit6f134a622b186df8a8b3b25d98cee70c78d1992a
tree18d0a8dbf2ebff9f9c58d6633fb11eeb6c762de4
parent4fb2eddfdf9adafde2e6f94de23202ee44123d59
nir/validate: Improve the validation of blocks

This commit adds a number of new validation checks:

 1. We now check that every block pointer in the IR points to a block
    that actually exists in a block list that's reachable from the
    nir_function_impl.

 2. We assert that nir_function_impl::body is non-empty

 3. We assert that the start block has no predecessors.  This is
    important because we tend to put run-once code there.

 4. We now validate some stuff on the end block.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6750>
src/compiler/nir/nir_validate.c