diff --git a/src/amdilc/amdilc_spirv.c b/src/amdilc/amdilc_spirv.c index e96ab97e..9a66657b 100644 --- a/src/amdilc/amdilc_spirv.c +++ b/src/amdilc/amdilc_spirv.c @@ -18,7 +18,10 @@ static void putBuffer( unsigned size = (buffer->wordCount + otherBuffer->wordCount) * sizeof(IlcSpvWord); if (buffer->wordSize < size) { // Grow the buffer exponentially to minimize allocations - buffer->wordSize = sizeof(IlcSpvWord); + if (buffer->wordSize < sizeof(IlcSpvWord)) { + buffer->wordSize = sizeof(IlcSpvWord) * 1024; + } + while (buffer->wordSize < size) { buffer->wordSize *= BUFFER_ALLOC_FACTOR; }