Skip to content

ILLink/ILC don't analyze boolean expressions for branch removal #102830

@jtschuster

Description

@jtschuster

The trim analyzer recognizes and understands && and || and will not warn for code that is guarded by a feature guard, but the trimmer and ilc don't understand it and will not eliminate the branch with problematic code and will warn if there is code that should be considered guarded.

This is expected according to the feature-checks docs: https://github.com/dotnet/runtime/blob/main/docs/design/tools/illink/feature-checks.md#boolean-andor

If neither tool recognizes the pattern and will warn, does it make sense for the analyzer to not warn and leave the user surprised at publish?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILLink.NET linker development as well as trimming analyzers

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions