util/ra: Sanity check that the driver selected a valid reg.
authorEric Anholt <eric@anholt.net>
Thu, 9 Apr 2020 21:11:51 +0000 (14:11 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Apr 2020 19:46:08 +0000 (19:46 +0000)
freedreno was returning -1 when it didn't pick a reg from the given bitset
due to an off-by-a-small-number error.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4537>

src/util/register_allocate.c

index faae56752cd2d8a15f3ccc4e17311e260bc854e1..a65b5ea154f70b96cf960821b8e0a6d0b2dab31c 100644 (file)
@@ -865,6 +865,7 @@ ra_select(struct ra_graph *g)
          }
 
          r = g->select_reg_callback(n, select_regs, g->select_reg_callback_data);
+         assert(r < g->regs->count);
       } else {
          /* Find the lowest-numbered reg which is not used by a member
           * of the graph adjacent to us.