[llvm] [InstrRef][nfc] Remove usage of unique_ptrs of arrays (PR #74203)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 11:32:49 PST 2023


felipepiovezan wrote:

>LGTM, with a preference for using a fixed-allocation set for EjectedBBs, rather than one that grows incrementally.

So it felt a bit wrong to use a `SmallDenseMap`  for something that should have been a set, and it felt extra wrong to use that when we have a data structure designed _specifically_ to be a _set of pointers_. This motivated me to look into the implementation of said data structure, and indeed it is designed exactly to be very conservative with memory allocation: it uses the same "Small" strategy of all "Small" containers, but when it needs to malloc, it will grab 128 elements right away. This should be more than enough for the vast majority of functions.

> If more than N insertions are performed, a single quadratically probed hash table is allocated and grows as needed, providing extremely efficient access (constant time insertion/deleting/queries with low constant factors) and is very _stingy with malloc traffic._

https://github.com/llvm/llvm-project/pull/74203


More information about the llvm-commits mailing list