[llvm-commits] [llvm] r98023 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
Evan Cheng
evan.cheng at apple.com
Tue Mar 16 23:19:48 PDT 2010
On Mar 16, 2010, at 6:41 PM, Chris Lattner wrote:
>
> On Mar 16, 2010, at 6:37 PM, Jakob Stoklund Olesen wrote:
>
>>>>
>>>> The attached graph shows the coalescer runtime as a function of the array length in my tiny test function (inlining disabled). The patch kicks in at N=500 and reduces runtime to nothing.
>>>
>>> Is it possible to fix or improve the N^2 algorithm?
>>
>> Yes, I think so. From the end of SimpleJoin:
>>
>> // Update the liveintervals of sub-registers.
>> if (TargetRegisterInfo::isPhysicalRegister(LHS.reg))
>> for (const unsigned *AS = tri_->getSubRegisters(LHS.reg); *AS; ++AS)
>> li_->getOrCreateInterval(*AS).MergeInClobberRanges(*li_, LHS,
>> li_->getVNInfoAllocator());
>>
>>
>> MergeInClobberRanges() is linear in the size of LHS, and SimpleJoin() is called once for each LiveRange in LHS -> quadratic runtime.
>>
>> However, SimpleJoin() is called to merge a trivial RHS into a complex LHS. It may be as simple as calling MergeClobberRanges(RHS) instead. I would have to read the code more closely.
>
> Nice, definitely sounds like a worthwhile experiment.
>
>> 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.
Evan
>
> cool, do that too! ;-)
>
> -Chris
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list