This is an archive of the discontinued LLVM Phabricator instance.

Fix a bug in IRMemoryMap which generated bogus allocations
ClosedPublic

Authored by zturner on Jun 25 2014, 1:09 AM.

Details

Summary

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:

  1. lower_bound(0) returns an iterator referring to allocation 1
  2. 0 is compared against 8192, and since 0 < 8192, it says there is no intersection.

With the patch, it does proper interval tests.

Diff Detail

Repository
rL LLVM

Event Timeline

zturner updated this revision to Diff 10822.Jun 25 2014, 1:09 AM
zturner retitled this revision from to Fix a bug in IRMemoryMap which generated bogus allocations.
zturner updated this object.
zturner edited the test plan for this revision. (Show Details)
zturner added a subscriber: Unknown Object (MLST).
zturner closed this revision.Jun 25 2014, 11:45 AM
zturner updated this revision to Diff 10846.

Closed by commit rL211726 (authored by @zturner).