Linker currently supports removal of unreachable if blocks (branches). For example:
int AlwaysZero { get => 0; }
void Test()
{
if (AlwaysZero == 0)
{
// This will be kept
}
else
{
// This entire block will be removed as it can't be reached
}
}
It doesn't support the same for blocks/branches in switch instructions. So for example:
int AlwaysZero { get => 0; }
void Test()
{
switch (AlwaysZero)
case 0:
// This will be kept
case 1:
case 2:
// This could be removed, but currently isn't
}