zequanwu added a comment.

In D130796#3696351 <https://reviews.llvm.org/D130796#3696351>, @labath wrote:

> In D130796#3692243 <https://reviews.llvm.org/D130796#3692243>, @zequanwu 
> wrote:
>
>> In D130796#3691227 <https://reviews.llvm.org/D130796#3691227>, @zequanwu 
>> wrote:
>>
>>>> If you find yourself needing to do extra work to work its limitations, we 
>>>> should fix that algorithm instead.
>>>
>>> That makes sense. I'll work on fixing `RangeVectorData`.
>>
>> After thinking it again, not just `RangeVectorData` need to be written but 
>> also `RangeVector`, although they are similar. It requires rewrite the whole 
>> file `RangeMap.h` and all other places uses its APIs.
>
> Why is that? I don't think we need to change the API -- just the way it is 
> implemented. And the RangeVectorData class already contains the upper_bound 
> argument, which should make it possible to find the element containing a 
> value quickly 
> <https://en.wikipedia.org/wiki/Interval_tree#Java_example:_Searching_a_point_or_an_interval_in_the_tree>.
>  That basically means taking the algorithm in FindEntryIndexesThatContain, 
> but making it stop at the first element found.
>
> And you can just ignore the RangeVector class. That problem (two separate 
> classes) can be handled separately and holistically.
>
> Alternatively, if we don't want to/need to support overlaps, we could switch 
> to some completely different class, which implements searches correctly. 
> llvm::IntervalMap, for example.

Oh, I didn't notice that FindEntryIndexesThatContain exist until now. This 
function indicates that it allows multiple overlapping ranges exist. I 
originally thought that it doesn't make sense to have overlapping ranges in 
variable locations and it must be a bug in debug info generation. But now what 
you are saying at here 
<https://github.com/llvm/llvm-project/issues/56616#issuecomment-1193951602>, 
"it means all of them are valid", makes sense to me. FindEntryIndexThatContains 
does the exact thing you mentioned.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130796/new/

https://reviews.llvm.org/D130796

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to