The IRMemoryMap represents a set of disjoint allocations, stored as an interval map. A bug in its allocation algorithm would cause this disjoint property to be violated, resulting in overlapping intervals in the map.
Consider the following scenario:
Allocation 1: 8 bytes, address 8192 is chosen by the allocator
Allocation 2: 524288, address 0 is probed
Without this patch, the IntersectsAllocation() method would behave as follows:
- lower_bound(0) returns an iterator referring to allocation 1
- 0 is compared against 8192, and since 0 < 8192, it says there is no intersection.
With the patch, it does proper interval tests.