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

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Dec 19 13:40:41 PST 2012

On Dec 19, 2012, at 8:58 AM, Borja Ferrer <borja.ferav at gmail.com> wrote:

> Hello Jakob,
> I think I've found something interesting that may help you get a better idea of what's going on.
> While looking at the debug info I noticed that the coalescer was removing lots of copies that could help the allocator make more cross class copies. As a test, I disabled the join-liveintervals option in the coalescer which gave me the surprise of  making the regalloc succeed. To show what I mean, I'm attaching two text files that show the debug info generated when this option is enabled and disabled for my target.
> To push things a bit further, I wrote a dirty hack in RegisterCoalescer::joinCopy() to return false when the dest regclass is too constrained. This allowed me executing the coalescer without crashing the regalloc. Obviously the generated code is not optimal at all, because there are many useless copies around. I'm pretty sure this is not the right fix at all, but it can give you a hint incase the problem is in the coalescer and not in the regalloc.

We did something like this back when the register allocator couldn't split live ranges.

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.


More information about the llvm-dev mailing list