It can happen that we create an enormous merge set, even larger than the
entire register file, in which case find_best_gap() would loop
infinitely. This seems to be triggered more often with
IR3_SHADER_DEBUG=spillall, since it actually happened with a CTS test.
Just bail out in that case.
Fixes:
0ffcb19b9d9 ("ir3: Rewrite register allocation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033>
find_best_gap(struct ra_file *file, unsigned file_size, unsigned size,
unsigned align, bool is_source)
{
+ /* This can happen if we create a very large merge set. Just bail out in that
+ * case.
+ */
+ if (size > file_size)
+ return (physreg_t) ~0;
+
BITSET_WORD *available =
is_source ? file->available_to_evict : file->available;