Commits

Michael Gottesman committed a301dbe5481
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