mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Commonly when an analysis uses subanalyses, we eagerly create the sub function info when constructing the main function info. This is not always necessary and when the subanalyses do work in their constructor, can be actively harmful if the parent analysis is never invoked. This utility class solves this problem by being a very easy way to perform a delayed call to the sub-analysis to get the sub-functioninfo combined with a cache so that after the LazyFunctionInfo is used once, we do not reuse the DenseMap in the sub-analysis unnecessarily. An example of where this can happen is in EpilogueARCAnalysis in combination with PostOrderFunctionInfo. PostOrderFunctionInfo eagerly creates a new post order. So, if we were to eagerly create the PostOrderFunctionInfo (the sub-functioninfo) when we created an EpilogueARCFunctionInfo, we would be creating a post order even if we never actually invoke EpilogueARCFunctionInfo.
9.5 KiB
9.5 KiB