Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid scanning typeof checks when building whole program view #103883

Merged
merged 2 commits into from
Jul 18, 2024

Commits on Jul 1, 2024

  1. Avoid scanning typeof checks when building whole program view

    Before this PR, we were somewhat able to eliminate dead typeof checks such as:
    
    ```csharp
    if (someType == typeof(Foo)
    {
        ExpensiveMethod();
    }
    ```
    
    This work was done in dotnet#102248.
    
    However, the optimization only happened during codegen. This meant that when building the whole program view, we'd still look at `ExpensiveMethod` and whatever damage this caused to the whole program view was permanent.
    
    With this PR, the scanner now becomes aware of the optimization we do during codegen and tries to defer injecting dependencies until we will need them.
    
    With this change, we detect the conditional branch, and generate whatever dependencies from the basic block as conditional. That way scanning can fully skip scanning `ExpensiveMethod` and the subsequent optimization will ensure the missed scanning will not cause issues at codegen time.
    MichalStrehovsky committed Jul 1, 2024
    Configuration menu
    Copy the full SHA
    6ec1308 View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2024

  1. Configuration menu
    Copy the full SHA
    29c3c45 View commit details
    Browse the repository at this point in the history