nir: Validate that a block doesn't have two identical successors.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 3 Sep 2015 08:29:38 +0000 (01:29 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 23 Sep 2015 17:59:59 +0000 (10:59 -0700)
This is invalid, and causes disasters if we try to unlink successors:
removing the first will work, but removing the second copy will fail
because the block isn't in the successor's predecessor set any longer.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/glsl/nir/nir_validate.c

index 9938c0ef8b19ebd5debf587b6b7a72d01d45dad3..1c9993a9c80d9b2dc3c800fb831f0eb6265be185 100644 (file)
@@ -586,6 +586,7 @@ validate_block(nir_block *block, validate_state *state)
    }
 
    assert(block->successors[0] != NULL);
+   assert(block->successors[0] != block->successors[1]);
 
    for (unsigned i = 0; i < 2; i++) {
       if (block->successors[i] != NULL) {