[llvm-dev] Incorrect LiveRange overlap

Steve Montgomery via llvm-dev llvm-dev at lists.llvm.org
Mon Feb 1 02:21:10 PST 2016


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.

Steve


-------------- next part --------------
A non-text attachment was scrubbed...
Name: LiveInterval.cpp.diff
Type: application/octet-stream
Size: 775 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160201/6e02c534/attachment.obj>


More information about the llvm-dev mailing list