Populate the CurrentBlockAnalysisData's _reachingWrites when creating an OperationTreeAnalysis. #73244
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Populate the CurrentBlockAnalysisData's _reachingWrites when creating an OperationTreeAnalysis.
This is similar to what FlowGraphAnalysisData does upon inspecting a new block.
Inspection of the lightbulb speedometer test demonstrated that a significant portion of CPU (~8%) in our OOP was spent in AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer. Looking at the code a bit indicated that the expensive calls to create/invoke the ControlFlowGraph weren't being short-circuited properly in the trivial cases I tried locally.
When a read operation is encountered, the code looks at all writes that are still unread. For each of these, it updates the map to indicate that the write has now been read. However, this wasn't working for parameters as the _reachingWrites collection didn't account for them.
As the image below indicates, of the 8% of CPU over 7% is accountable to the CFG. With that short-circuited more commonly now, we should save quite a bit of CPU during execution of this analyzer.