[LLVMdev] LLVM ERROR: ran out of registers during register allocation

Borja Ferrer borja.ferav at gmail.com
Wed Jan 9 10:46:58 PST 2013


Ok, I've found that marking tiny live intervals as not spillable inside
VirtRegAuxInfo::CalculateWeightAndHint is not playing nicely with very
constrained regclasses, in my case a regclass composed of only one
register.
As a workaround, instead of marking them as not spillable, I've marked them
with a very high spill cost and the regalloc is able to compile the
function with good code quality. To avoid doing this for all live intervals
of this regclass, I'm filtering only the ones that dont have a small size
(returned by li.getSize())

Does this possible cause make any sense at all?

In either case, in the meantime, I can live with this workaround until an
official fix is implemented. I'll fill in a bug report to track this
problem so you can take a look at it when appropiate.

2013/1/7 Jakob Stoklund Olesen <stoklund at 2pi.dk>

>
> On Jan 7, 2013, at 4:58 AM, Borja Ferrer <borja.ferav at gmail.com> wrote:
>
> Hello Jakob,
>
> Did you get a chance to take a look into this, and if not, can you do it
> when you get some spare time?
>
>
> It's not likely I'll have time to look at this in the near future. I'd
> recommend you do it yourself.
>
> /jakob
>
>
> 2012/12/19 Borja Ferrer <borja.ferav at gmail.com>
>
>> We did something like this back when the register allocator couldn't
>>> split live ranges.
>>>
>>
>> Yes, I remember the isWinToJoinCrossClass() function, removed here:
>>
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterCoalescer.cpp?r1=152016&r2=155551&diff_format=h
>> that prevented some coalescing to the cost of leaving many unnecessary
>> copies around for very constrained regclasses like the one I have.
>>
>>
>>>
>>> The problem is that any heuristic you can come up with only makes the
>>> problem less likely to happen. It doesn't actually fix it.
>>>
>>
>> Indeed, that heuristic I wrote is a nasty hack and not the way of fixing
>> it correctly. Now that the regalloc has much more freedom on making changes
>> in the code I hope it is fixable. If you need any other info apart of the
>> dumps I've already attached please ask.
>>
>> Thanks!
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130109/cfa9d777/attachment.html>


More information about the llvm-dev mailing list