Commit Graph

5 Commits

Author SHA1 Message Date
Andrew Trick
321b109d08 PreallocatedMap::find fix for yesterday's bad fix. Don't read past end.
Swift SVN r21024
2014-08-04 19:42:18 +00:00
Andrew Trick
bc34ed1d76 Fix PreallocatedMap::find to check for missing keys.
This is a quick fix for a hang in EnumSimplification.

Swift SVN r20987
2014-08-03 23:40:33 +00:00
Michael Gottesman
0ac42332d0 Remove PreallocatedMap::operator[]. Change PreallocatedMap::find to return .end() if the map is not sorted in release builds.
I put in an assert for debug builds so we will be able to catch this.

Swift SVN r19908
2014-07-13 22:26:46 +00:00
Michael Gottesman
59c89e56ce [g-arc-opts] Change Global ARC Sequence Dataflow to use PreallocatedMap.
This will speed up the optimizer by reducing the amount of allocations
we perform while running the optimizer.

Swift SVN r18762
2014-06-09 23:09:04 +00:00
Michael Gottesman
a301dbe548 Add in PreallocatedArray, PreallocatedMap data structures.
These arrays are meant to be used in situations where you want to allocate a
potentially large amount of default constructible items for a collection of
fixed size.

An example of such a use case is for data flow algorithms which need a
one to one mapping from BB -> StateObject. In such a case, if the state
object is default constructible, we can allocate all of the structures
first, initialize them for each BB, and then process as we normally
would. Thus we eliminate overhead due to memory allocation.

Since the data structures take an allocator it also enables one to use it in
cases where one allocates memory from an allocator and references it via an
ArrayRef. We do this in swift when storing data into certain instructions.

Another benefit over using DenseMaps in such cases is that a DenseMap (unless
you preallocate) can cause all sorts of invalidation issues as new states are
added.

I am planning on using this in my Enum Simplification work and changing
the Global ARC Optimizer to use this.

Swift SVN r18739
2014-06-08 22:52:12 +00:00