dotnet / linker

388 stars 127 forks source link

Remove redundant checks in IntrinsicId switch statements #3060

Closed jtschuster closed 1 year ago

jtschuster commented 1 year ago

In ReflectionMethodBodyScanner and HandleCallAction, we do many of the same checks that already occur in GetIntrinsicIdFromMethod, and in a few places we have 'when' conditions that could just be regular cases. This removes the extra checks so the switch can be simpler and more optimized.

In the linker, we also get the IntrinsicId twice, so this adds an optional parameter for a known IntrinsicId.