Skip to content

Simple dead code elimination for static property calls #752

@marek-safar

Description

@marek-safar

The idea is to be able to remove code which depends on a property which can be either determined as logically false or has value overwritten by the linker argument

class C
{
  public static void Main ()
  {
    if (!Environment.Is64BitProcess)
      Console.WriteLine ();
  }
}

For the example above the linker should remove the condition block, e.g. by replacing it with nops and not to pull any dependencies for Console.WriteLine.

For the initial version it’s enough to be able to detect bool like properties only.

Extracted from #607 to make it actionable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions