When running IPSCCP on a module with many small functions, memory usage is currently dominated by PredicateInfo, which is a huge structure (partially due to some unfortunate nested SmallVector use). However, most of it is actually only temporary analysis state, and does not need to be retained after initial construction.
This patch factors the temporary state out into a separate structure that is only live during the analysis.
Could all those helpers be moved into State?
That way, we would not need to thread the parameter through the code and we would even more cleanly separate the build phase. If it is possible to move the construction parts into State, it might make sense to rename it to something like PredicateInfoBuilder and PredicateInfo itself would only contain PredicateMap, CreatedDeclarations, AllInfos. The builder could hold references to those.