dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.42k stars 4.76k forks source link

Switch recognition should not be lexical #107076

Open jakobbotsch opened 2 months ago

jakobbotsch commented 2 months ago

https://github.com/dotnet/runtime/blob/7ff684af49cdf008bebbe10efcc10a2649795d65/src/coreclr/jit/switchrecognition.cpp#L172-L173

The switch recognition is currently lexical for (from what I can tell) no good reason. Instead, it seems we should be able to recognize any chain of comparisons by following the "did not equal" target.

cc @dotnet/jit-contrib @JulieLeeMSFT @EgorBo

dotnet-policy-service[bot] commented 2 months ago

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch See info in area-owners.md if you want to be subscribed.