util/ra: Sanity check that we're adding a valid reg to a class.

BITSET_SET might not segfault on you right away if you're just slightly
off, and an assert is nicer anyway.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4537>
This commit is contained in:
Eric Anholt 2020-04-09 15:10:08 -07:00 committed by Marge Bot
parent 5bcaf30aba
commit a1de267a21
1 changed files with 2 additions and 0 deletions

View File

@ -371,6 +371,8 @@ ra_class_add_reg(struct ra_regs *regs, unsigned int c, unsigned int r)
{
struct ra_class *class = regs->classes[c];
assert(r < regs->count);
BITSET_SET(class->regs, r);
class->p++;
}