intel/ir: Don't allow allocating zero registers
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 11 Oct 2018 18:52:45 +0000 (13:52 -0500)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 12 Dec 2018 03:26:23 +0000 (21:26 -0600)
This simple check helps catch bugs early that can end up propagating
into later stages of the compile and triggering strange asserts.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/intel/compiler/brw_ir_allocator.h

index b1237ed38e729bd01c9765d63d227a890901dfb8..9f124645ba2f7bb8acb67b600d59ebd513141ef0 100644 (file)
@@ -47,6 +47,7 @@ namespace brw {
       unsigned
       allocate(unsigned size)
       {
+         assert(size > 0);
          if (capacity <= count) {
             capacity = MAX2(16, capacity * 2);
             sizes = (unsigned *)realloc(sizes, capacity * sizeof(unsigned));