[llvm-commits] [llvm] r98023 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Evan Cheng evan.cheng at apple.com
Wed Mar 17 09:59:33 PDT 2010


On Mar 17, 2010, at 7:25 AM, Jakob Stoklund Olesen wrote:

> 
> On Mar 16, 2010, at 11:19 PM, Evan Cheng wrote:
>>> On Mar 16, 2010, at 6:37 PM, Jakob Stoklund Olesen wrote:
> 
>>>> Ideally, I want to avoid physreg joining altogether, and use better hinting instead. Half of the coalescer would go away, and all of the bugs ;-)
>> 
>> That's the proper way to fix this. But we are ready to just do this yet. At least not with the short comings of linear scan.
> 
> Do we know what those shortcomings are?

Linearscan just isn't designed to deal with hints effectively. It's top down, which means it has to get lucky to be able to follow the hint. A priority based approach should work better especially for dealing with short intervals with high spill weights.

> 
> My plan is to calculate hints at the same time as spill weights, instead of during coalescing. That allows a weighted vote in case there are multiple physreg copies of the same vreg. (Right now, the vote goes to whatever physreg was seen last.)
> 
> Second, I want to recalculate hints (and possibly spill weights) after breaking up a live interval for spilling.
> 
> In a perfect world, we could eliminate the trivial coalescing pass after register allocation too.

I think these are goodness regardless. But disabling physreg / vreg coalescing means the regalloc need to get *every* case we care about right. I am skeptical this is enough given linearscan's design constraint.

Evan

> 
> One problem is that linear scan resets the hints when it is backtracking, are there others?
> 
> /jakob
> 





More information about the llvm-commits mailing list