IR: Track analysis invalidation state by result list index (#242007)
AnalysisManager::invalidate recorded whether each cached result was
invalidated in a 32 entry SmallDenseMap, and the Invalidator found
dependencies through the AnalysisResults map. Keep the states in a
vector parallel to the IR unit's result list instead, and find
dependencies by scanning that short list. With N cached analyses for
the IR unit, each lookup is O(N) and invalidation O(N^2) in the worst
case. N is bounded by the number of registered analyses rather than
the size of the IR: functions have about 11 cached results in O3 (at
most 22), and the average scan costs about as much as the hash probe
it replaces.
CTMark instructions:u, geomean: O3 -0.27%, ThinLTO -0.30%
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>