This patch isn't read for submission yet; it's a vehicle for discussion.
By tuning the initialize sizes of the SmallVector's used by AnalysisUsage, I can cut the memory allocated for all AnalysisUsage objects in the legacy pass manager by nearly 40kb on -O3. This is over half (original 77kb, new 38kb) of the memory allocated from that site (reporting via massif). The peak memory usage is reduced from 762 KB to 716 KB.
I picked these thresholds somewhat at random. Given the result, I'm really questioning whether small vector is even the right data structure for this case. Does anyone have any data on the actual numbers of dependencies? I can measure, but I thought I'd ask first.
Chandler - I haven't examined how AnalysisUsage is used by the new pass manager. If I tune for performance/memory in the old pass manager, am I going to possible make things worse for the new one? What do I need to watch out for in expected usage patterns?
Alternatively, you could use: