Incorrect LiveRange overlap

I think there is a bug in the the code that checks whether two LiveRanges have overlapping segments that are not coalescable.

I’ve got two ranges [608r,656r:0)[656r,672r:1) and [0B,32r)[672r,688r). I don’t believe that these overlap and that is confirmed if I use LiveRange::overlaps(SlotIndex Start, SlotIndex End) to check.

However, the version of LiveRange::overlaps that takes a CoalescerPair and checks for coalescable segments thinks that these ranges _do_ overlap.

I think the problem is in the loop that advances the iterator that ends earliest. I think it should advance until J->end > I->start, not >=. That way, I think it would have the same effect as LiveRange::find() which is what I believe the code is aiming to do, just more efficiently than find().

This is causing me a problem because I sometimes get the greedy register allocator running out of registers because of spurious interference.

I’ve attached a patch which fixes things for me and would be grateful for another opinion on whether there’s a real bug here, or whether I’m misunderstanding.


LiveInterval.cpp.diff (775 Bytes)