which Register allocator to use with llc -O0


We were using “linearscan” register scan with llc -O0 option. As per the llvm blog, this is replaced with greedy register alloation.

But I think, this register allocation (i.e. 'greedy and ‘basic’) is blocked if used with -O0 option of llc. Only ‘fast register allocator’ option can be used with -O0.

I wanted to understand that what will be consequence of forcefully enabling ‘greedy allocation’ ?


You can use RAGreedy with -O0, but you need to enable the full optimizing register allocation pipeline:

$ llc -O0 -optimize-regalloc

Same thing if you want to use RABasic.