This is an archive of the discontinued LLVM Phabricator instance.

Return correct entry in RangeDataVector::FindEntryThatContains
Needs ReviewPublic

Authored by shivammittal99 on Apr 6 2020, 9:58 AM.

Details

Reviewers
labath
Summary

The FindEntryThatContains function does not return the correct entry in
the case when two non-consecutive entries contain the range.
Eg. Vector = [(0, 40, 0), (10, 10, 1)] and query = (25, 1). The function
currently returns nullptr, but it should return entry 0.

Signed-off-by: Shivam Mittal <shivammittal99@gmail.com>

Diff Detail

Event Timeline

shivammittal99 created this revision.Apr 6 2020, 9:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 6 2020, 9:58 AM

This is definitely a bug, but I fear that fixing this via a linear search will cause a big performance regression. Fortunately, since D74759 we now have a way to implement this more efficiently. Could you reimplement this function to use the binary search tree introduced in that patch?

If not, I can get around to it soon-ish, but I currently have a bunch of other things waiting in my queue...