diff options
author | Ilia Mirkin <imirkin@alum.mit.edu> | 2016-05-31 00:33:50 -0400 |
---|---|---|
committer | Ilia Mirkin <imirkin@alum.mit.edu> | 2016-05-31 23:25:51 -0400 |
commit | 18d11c998940d4228ce0f5057042a885f1aa65af (patch) | |
tree | bfefe27050f68ac983c197fbc9c22bb677b3e86a | |
parent | d873608bcf97cddaaca396d29f065657c1f63039 (diff) |
nv50/ir: fix error finding free element in bitset in some situations
This really only hits for bitsets with a size of a multiple of 32. We
can end up with pos = -1 as a result of the ffs, which we in turn decide
is a valid position (since we fall through the loop and i == 1, we end
up adding 32 to it, so end up returning 31 again).
Up until recently this was largely unreachable, as the register file
sizes were all 63 or 255. However with the advent of compute shaders
which can restrict the number of registers, this can now happen.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "12.0" <mesa-stable@lists.freedesktop.org>
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp index d26acb304bc..682c5690624 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_util.cpp @@ -365,6 +365,12 @@ int BitSet::findFreeRange(unsigned int count) const } } } + + // If we couldn't find a position, we can have a left-over -1 in pos. Make + // sure to abort in such a case. + if (pos < 0) + return -1; + pos += i * 32; return ((pos + count) <= size) ? pos : -1; |